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


Python GL.glGenLists方法代码示例

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


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

示例1: RedoDisplayList

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def RedoDisplayList(self):
        #print "Common2d3dObject.RedoDisplayList", self

        if hasattr(self, 'dpyList') and self.dpyList is not None:
            lNewList = self.dpyList[0]
        else:
            lNewList = GL.glGenLists(1)
            self.viewer.deleteOpenglList()

        #lNewList = self.newList
        lContext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
        #print "lNewList Common2d3dObject.RedoDisplayList", lNewList, lContext, self.name
        self.dpyList = ( lNewList,
                         self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
                       )
        GL.glNewList(self.dpyList[0], GL.GL_COMPILE)
        #print '+%d'%self.dpyList[0], lContext, "glNewList Common2d3dObject"
        if hasattr(self, 'Draw'):
            status = self.Draw()
        else:
            status = 0
        #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList Common2d3dObject"
        GL.glEndList()
        if status == 0:
            self.deleteOpenglList()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:27,代码来源:Common2d3dObject.py

示例2: redoDisplayListCSG

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def redoDisplayListCSG(self):
        if self.dpyListCSG is not None:
            GL.glDeleteLists(1, self.dpyListCSG)
        
        g = self.geom
        self.dpyListCSG = GL.glGenLists(1)
        GL.glNewList(self.dpyListCSG, GL.GL_COMPILE)
##         if isinstance(g, Spheres):
##             g.DisplayFunction()
##         else:
        self.drawpolygons()
        GL.glEndList()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:14,代码来源:csgClip.py

示例3: makeTemplate

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def makeTemplate(self):
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
        #print "Spheres.makeTemplate", self.quality
        # it is asumed the right OpenGL context is active
        # make sure we are not already in a newlist
        if GL.glGetIntegerv(GL.GL_LIST_INDEX) == [0]:
            assert self.templateDSPL is None
            lFirstList = GL.glGenLists(3)
            #lFirstList = self.firstList
            #print "Spheres.makeTemplate", lFirstList
            #print "lFirstList Spheres.makeTemplate", lFirstList, self.name
            lCurrentContext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w,
                                                        'contexttag')
            self.templateDSPL = ( lFirstList, lCurrentContext )

            if (hasattr(DejaVu, 'enableVBO') and DejaVu.enableVBO) \
              or DejaVu.enableVertexArrayNonVBO is True :
                lSphereGeom = self.asIndexedPolygons(run=1, quality=self.quality-1,
                                                     centers=((0,0,0),), radii=((1.,),) )
                GL.glNewList(lFirstList+1, GL.GL_COMPILE)
                lSphereGeom.Draw()
                GL.glEndList()
                lSphereGeom.Set(invertNormals=True)
                GL.glNewList(lFirstList+2, GL.GL_COMPILE)
                lSphereGeom.Draw()
                GL.glEndList()
            else:
                quality = self.quality * 5
                GL.glNewList(lFirstList+1, GL.GL_COMPILE)
                #print '+%d'%(lFirstList+1), lCurrentContext, "glNewList Spheres1"
                extractedGlutSolidSphere(1, quality, quality, 0)
                #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList Spheres1"
                GL.glEndList()
                GL.glNewList(lFirstList+2, GL.GL_COMPILE)
                #print '+%d'%(lFirstList+2), lCurrentContext, "glNewList Spheres2"
                extractedGlutSolidSphere(1, quality, quality, 1)
                #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList Spheres2"
                GL.glEndList()

            self.chooseTemplate()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:43,代码来源:Spheres.py

示例4: makeTemplate

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def makeTemplate(self):
        #print "Ellipsoids.makeTemplate"
        # it is asumed the right OpenGL context is active
        assert self.templateDSPL is None
        lFirstList = GL.glGenLists(3)
        #print "lFirstList Ellipsoids.makeTemplate", lFirstList, self.name
        lCurrentContext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
        self.templateDSPL = ( lFirstList, lCurrentContext )

        GL.glNewList(lFirstList+1, GL.GL_COMPILE)
        #print '+%d'%(lFirstList+1), lCurrentContext, "glNewList Ellipsoids1"
        extractedGlutSolidSphere(1, self.slices, self.stacks, 0)
        #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList Ellipsoids1"
        GL.glEndList()
        
        GL.glNewList(lFirstList+2, GL.GL_COMPILE)
        #print '+%d'%(lFirstList+2), lCurrentContext, "glNewList Ellipsoids2"
        extractedGlutSolidSphere(1, self.slices, self.stacks, 1)
        #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList Ellipsoids2"
        GL.glEndList()

        self.chooseTemplate()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:24,代码来源:Ellipsoids.py

示例5: RedoDisplayList

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def RedoDisplayList(self):
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
            #print "IndexedGeom.RedoDisplayList", self.name
##          if __debug__:
##              print 'IndexedGeom RedoDisplayList for', self.fullName

        Geom.RedoDisplayList(self)

        if len(self.faceSet) and len(self.vertexSet) \
          and (   self.primitiveType == GL.GL_TRIANGLES \
               or self.primitiveType == GL.GL_QUADS \
               or self.primitiveType == GL.GL_POLYGON):

            # we always build this, that way we don't have to built on demand
            outl = self.outline
            if outl.colorAsMaterial:
                if self.materials[GL.GL_FRONT] and \
                       not self.inheritMaterial:
                    mat = self.materials[GL.GL_FRONT]
                    fpProp = []
                    fpBind = []
                    for propInd in range(4):
                        b, p = mat.GetProperty(propInd)
                        fpProp.append(p)
                        fpBind.append(b)
                    fpProp.append(mat.prop[4])
                    fpBind.append(mat.binding[4])
                else:
                    fpProp = None
                    fpBind = None

                if self.materials[GL.GL_BACK] and \
                   not self.inheritMaterial:
                    mat = self.materials[GL.GL_BACK]
                    bpProp = []
                    bpBind = []
                    for propInd in range(4):
                        b, p = mat.GetProperty(propInd)
                        bpProp.append(p)
                        bpBind.append(b)
                    bpProp.append(mat.prop[4])
                    bpBind.append(mat.binding[4])

                else:
                    bpProp = None
                    bpBind = None
            else:
                fpProp = bpProp = fpBind = bpBind = None

            texCoords = None

            if outl.lighting:
                norms = self.normals
            else:
                norms = None

            # WARNING: if texture, fpProp, bpProp, fpBind, bpBind,
            # are not passed (either None or arrays) we get a segmentation
            # fault if the surface has many colors (i.e. color MSMS by atom
            # type and dispaly outline seg faults)

            # calling with too many arguments segaults too
            # just add  None, None, None, None, after the line with colors

            if hasattr(outl, 'dpyList') and outl.dpyList is not None:
                lNewList = outl.dpyList[0]
            else:
                lNewList = GL.glGenLists(1)
                self.viewer.deleteOpenglList()

            #print "lNewList IndexedGeom.RedoDisplayList", lNewList, self.name
            lCurrentContext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
            outl.dpyList = ( lNewList, lCurrentContext)
                             
            GL.glNewList(outl.dpyList[0], GL.GL_COMPILE)
            #print '+%d'%outl.dpyList[0], lCurrentContext, "glNewList IndexedGeom"
            status=glDrawIndexedGeom(
                GL.GL_TRIANGLES,
                self.vertexSet.vertices.array,
                self.faceSet.faces.array,
                norms,
                texCoords,
                fpProp, bpProp, fpBind, bpBind,
                self.frontAndBack,
                1)  # 1 means use diffuse component if no lighting
            #print '*%d'%GL.glGetIntegerv(GL.GL_LIST_INDEX), "glEndList IndexedGeom"
            GL.glEndList()
            if not status:
                #print '-%d'%outl.dpyList[0], "glDeleteLists IndexedGeom"
                GL.glDeleteLists(outl.dpyList[0], 1)
                outl.dpyList = None
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:94,代码来源:IndexedGeom.py

示例6: getDpyList

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGenLists [as 别名]
    def getDpyList(self,objects):
        """function to obtain a display list for any object in DejaVu"""
        from opengltk.OpenGL import GL
        # Draw build a display function that contains global coloring,
        # transformation nd all global GL properties of this objects.
        # we cannot use the object's display list that does not contains this
        # info
        #if len(objects) == 1 and objects[0].dpyList:
        #    return objects[0].dpyList
        # transparent object need to be drawn last

        # reorder object so transparent object drawn last
        transparent =[]
        opaque = []
        for obj in objects:
            if obj.transparent: #obj.isTransparent():
                transparent.append(obj)
            else:
                opaque.append(obj)
        objlist = opaque + transparent
        
        lNewList = GL.glGenLists(1)
        #print "lNewList geomsChooser.getDpyList", lNewList, self.name
        dpyList = ( lNewList,
                   self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
                  )

        camera = self.mv.GUI.VIEWER.currentCamera
        camera.Activate()

        GL.glNewList(dpyList, GL.GL_COMPILE)
        #print "geomChooser 208", GL.glGetIntegerv(GL.GL_LIST_INDEX)
        for obj in objlist:
            if obj.immediateRendering: # or obj.hasChildWithImmediateRendering:
                camera.drawMode=5
                camera.Draw(obj)
            else:
                camera.drawMode=2
                camera.drawTransparentObjects = 0
                camera.hasTransparentObjects = 0
                # draw opaque object
                for m in obj.instanceMatricesFortran:
                    GL.glPushMatrix()
                    GL.glMultMatrixf(m)
                    if len(obj.children):
                        map( camera.Draw, obj.children)
                    else:
                        camera.Draw(obj)
                    GL.glPopMatrix()
                
                # draw transparent children of object
                if camera.hasTransparentObjects:
                    camera.drawTransparentObjects = 1
                    for m in obj.instanceMatricesFortran:
                        GL.glPushMatrix()
                        GL.glMultMatrixf(m)
                        map( camera.Draw, obj.children)
                        GL.glPopMatrix()
                # draw transparent object that do not have children
                if obj.isTransparent() and not len(obj.children):
                    camera.drawTransparentObjects =1
                    for m in obj.instanceMatricesFortran:
                        GL.glPushMatrix()
                        GL.glMultMatrixf(m)
                        camera.Draw(obj)
                        GL.glPopMatrix()
                    

        GL.glEndList()    
        return dpyList
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:72,代码来源:geomsChooser.py


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