当前位置: 首页>>代码示例>>Python>>正文


Python GL.glCullFace方法代码示例

本文整理汇总了Python中opengltk.OpenGL.GL.glCullFace方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glCullFace方法的具体用法?Python GL.glCullFace怎么用?Python GL.glCullFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opengltk.OpenGL.GL的用法示例。


在下文中一共展示了GL.glCullFace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SetupGL

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glCullFace [as 别名]
    def SetupGL(self):
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
        """Setup OpenGL rendering state for this object
"""
        #print "SetupGL", self

        if not self.inheritMaterial:
            self.InitMaterial()
            self.InitColor()

        if self.GetLighting():
            #glEnable(GL_LIGHTING)
            if self.viewer is not None:
                self.viewer.enableOpenglLighting()

            shading = self.GetShading()

	    if shading != GL.GL_NONE:
                if self.normals is not None:
                    if (shading==GL.GL_SMOOTH and \
                        len(self.normals)!=len(self.vertexSet)) or \
                        (shading==GL.GL_FLAT and \
                         len(self.normals)!=len(self.faceSet)):
                        self.GetNormals()
                        self.viewer.objectsNeedingRedo[self] = None

		GL.glShadeModel(shading)

	else: # no lighting
	    GL.glDisable(GL.GL_LIGHTING)

	if not self.inheritCulling:
	    if self.culling in (GL.GL_BACK, GL.GL_FRONT, GL.GL_FRONT_AND_BACK):
		GL.glCullFace(self.culling)
		GL.glEnable(GL.GL_CULL_FACE)
	    else: GL.glDisable(GL.GL_CULL_FACE)

	if not self.inheritFrontPolyMode:
            mode =self.frontPolyMode
            if self.frontPolyMode==viewerConst.OUTLINED:
                mode = GL.GL_FILL
	    if self.frontAndBack:
		GL.glPolygonMode(GL.GL_FRONT_AND_BACK, mode)
	    else:
		GL.glPolygonMode(GL.GL_FRONT, mode)

	if not self.inheritBackPolyMode:
            mode = self.backPolyMode
            if self.backPolyMode==viewerConst.OUTLINED:
                mode = GL.GL_FILL
	    GL.glPolygonMode(GL.GL_BACK, mode)

	#self._AntiAliasing()
	self._WidthAndStipple()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:57,代码来源:Displayable.py

示例2: DisplayFunction

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glCullFace [as 别名]
    def DisplayFunction(self):
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
        """display a set of indexed geometric primitives"""
        
        if self.dpyList:

#            print "DisplayFunction", self.dpyList, self.fullName

            lDrawOutline = (self.getDrawOutlineMode('front'), self.getDrawOutlineMode('back'))
            if (lDrawOutline[0] or lDrawOutline[1]) and self.viewer.hasOffsetExt:

                outl = self.outline

                if   self.GetPolyMode('front') == GL.GL_FILL \
                  or self.GetPolyMode('back') == GL.GL_FILL:

                    mode = GL.GL_POLYGON_OFFSET_FILL

                    GL.glEnable(mode)
                    self.viewer.polyOffset( outl.factor, outl.unit)
                    Geom.DisplayFunction(self)
                    GL.glDisable(mode)

                    GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
                    if not outl.colorAsMaterial:
                        if outl.lighting:
                            GL.glMaterialfv( GL.GL_FRONT_AND_BACK,
                                             GL.GL_EMISSION,
                                             outl.color )
                        else:
                            GL.glDisable(GL.GL_LIGHTING)
                            GL.glColor4fv (outl.color)

                    GL.glLineWidth(outl.lineWidth)

                    if lDrawOutline[0] is False or lDrawOutline[1] is False:
                        GL.glEnable(GL.GL_CULL_FACE)
                        if lDrawOutline[0]:
                            GL.glCullFace(GL.GL_BACK)
                        elif lDrawOutline[1]:
                            GL.glCullFace(GL.GL_FRONT)
                    else:
                        GL.glDisable(GL.GL_CULL_FACE)

                    if outl.dpyList:
                        currentcontext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
                        if currentcontext != outl.dpyList[1]:
                            warnings.warn("""DisplayFunction failed because the current context is the wrong one""")
                            #print "currentcontext != outl.dpyList[1]", currentcontext, outl.dpyList[1]
                        else:
                            #print '#%d'%outl.dpyList[0], currentcontext, "glCallList IndexedGeom"
                            GL.glCallList(outl.dpyList[0])

                    GL.glEnable(GL.GL_CULL_FACE)
                    GL.glEnable(GL.GL_LIGHTING)

                else:
                    Geom.DisplayFunction(self)
            else:
                Geom.DisplayFunction(self)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:63,代码来源:IndexedGeom.py


注:本文中的opengltk.OpenGL.GL.glCullFace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。