當前位置: 首頁>>代碼示例>>Python>>正文


Python GL.glGenLists方法代碼示例

本文整理匯總了Python中OpenGL.GL.glGenLists方法的典型用法代碼示例。如果您正苦於以下問題:Python GL.glGenLists方法的具體用法?Python GL.glGenLists怎麽用?Python GL.glGenLists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenGL.GL的用法示例。


在下文中一共展示了GL.glGenLists方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: drawIndicator

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def drawIndicator(self, intersect_point, normal):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)
        u, v = self.skin_surf.getTangentCoordinates(normal)


        self.qglColor(RED)
        self.ellipse(intersect_point,normal, u,v,[6,6]);


        GL.glEndList()


        return genList

    #draws a simple model of an electrode 
開發者ID:simnibs,項目名稱:simnibs,代碼行數:18,代碼來源:head_model_OGL.py

示例2: initgl

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def initgl(self):
        '''App-specific initialization for after GLUT has been initialized.'''
        import OpenGL.GL as gl
        self.gllist_id = gl.glGenLists(9)
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glEnableClientState(gl.GL_COLOR_ARRAY)
        gl.glDisable(gl.GL_LIGHTING)
        gl.glDisable(gl.GL_TEXTURE_2D)
        gl.glDisable(gl.GL_FOG)
        gl.glDisable(gl.GL_COLOR_MATERIAL)
        gl.glEnable(gl.GL_DEPTH_TEST)
        gl.glShadeModel(gl.GL_FLAT)
        self.set_data(self.data, classes=self.classes, features=self.features)

        try:
            import OpenGL.GLUT as glut
            glut.glutInit()
            self._have_glut = True
        except:
            pass 
開發者ID:spectralpython,項目名稱:spectral,代碼行數:22,代碼來源:ndwindow.py

示例3: makeList

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def makeList(self, drawFunc):
        if self._list:
            return

        drawFunc = (drawFunc or self.drawFunc)
        if drawFunc is None:
            return

        l = gl.glGenLists(1)
        GL.glNewList(l, GL.GL_COMPILE)
        drawFunc()
        # try:
        GL.glEndList()
        #except GL.GLError:
        #    print "Error while compiling display list. Retrying display list code to pinpoint error"
        #    self.drawFunc()

        self._list = numpy.array([l], 'uintc') 
開發者ID:mcgreentn,項目名稱:GDMC,代碼行數:20,代碼來源:glutils.py

示例4: __init__

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def __init__(self, obj_info, rotation_matrix, swapyz=False, layout_type=None):
        """Loads a Wavefront OBJ file. """
        self.vertices = obj_info.vertices
        self.normals = obj_info.normals
        self.texcoords = obj_info.texcoords
        self.faces = obj_info.faces
        self.rotation_matrix = rotation_matrix

        # load the mesh to OPENGL
        self.gl_list = GL.glGenLists(1)
        GL.glNewList(self.gl_list, GL.GL_COMPILE)
        for face in self.faces:
            vertices, normals, _, _ = face
            GL.glBegin(GL.GL_POLYGON)
            for i in range(len(vertices)):
                normal_color = self.rotation_matrix.dot(self.normals[normals[i] - 1])
                GL.glColor3f((normal_color[0] + 1) / 2, (-normal_color[2] + 1) / 2, (normal_color[1] + 1) / 2)
                GL.glVertex3fv(self.vertices[vertices[i] - 1])
            GL.glEnd()
        GL.glEndList() 
開發者ID:thusiyuan,項目名稱:holistic_scene_parsing,代碼行數:22,代碼來源:render_scene.py

示例5: drawEEGPositions

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def drawEEGPositions(self, points, names):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)
        for point, name in zip(points, names):
            normal = self.skin_surf.projectPoint(point, smooth=False)[1]
            if normal is None or normal == []or point is None or point == []:
                print('Invalid Point!')
            else:
                u, v = self.skin_surf.getTangentCoordinates(normal)
                pos_el = point + 2*normal
                GL.glEnable(GL.GL_LIGHTING)
                self.qglColor(GREEN)
                self.ellipse(pos_el, normal, u, v, [6, 6])
                if bool(GLUT.glutBitmapString):
                    pos_text = point + 5*normal
                    GL.glDisable(GL.GL_LIGHTING)
                    GL.glColor3f(0.0, 0.0, 0.0)
                    GL.glRasterPos3f(*pos_text)
                    GLUT.glutBitmapString(
                        GLUT.GLUT_BITMAP_HELVETICA_12,
                        name.encode())
                    GL.glEnable(GL.GL_LIGHTING)

        GL.glEndList()
        self.eegPositions = genList
        self.update() 
開發者ID:simnibs,項目名稱:simnibs,代碼行數:28,代碼來源:head_model_OGL.py

示例6: glGenLists

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def glGenLists(cls, n):
        cls.listCount += n
        return GL.glGenLists(n) 
開發者ID:mcgreentn,項目名稱:GDMC,代碼行數:5,代碼來源:glutils.py

示例7: draw

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def draw(self):
        if self._displayList is None:
            self._displayList = GL.glGenLists(1)

        if self.invalidList:
            self.compileList()

        GL.glCallList(self._displayList) 
開發者ID:mcgreentn,項目名稱:GDMC,代碼行數:10,代碼來源:drawable.py

示例8: createGLDisplayList

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def createGLDisplayList(self):
        """
        Create a display list that includes all previous CSIs plus this one,
        for a single display list giving a full model rendering up to this step.
        """

        if self.glDispID == LicGLHelpers.UNINIT_GL_DISPID:
            self.glDispID = GL.glGenLists(1)
        GL.glNewList(self.glDispID, GL.GL_COMPILE)
        # LicGLHelpers.drawCoordLines()
        self.__callPreviousGLDisplayLists(True)
        GL.glEndList() 
開發者ID:remig,項目名稱:lic,代碼行數:14,代碼來源:LicModel.py

示例9: drawPointAndDirs

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def drawPointAndDirs(self):

        xAxis = numpy.array([1,0,0], 'float')
        yAxis = numpy.array([0,1,0], 'float')
        zAxis = numpy.array([0,0,1], 'float')
        center =numpy.array([0,0,0], 'float')



        qobj = GLU.gluNewQuadric()
        sphere_radius = 0.1
        cyl_height = 1
        cyl_radius = 0.01
        z_dir = numpy.array([0.,0.,1.], dtype = 'float64')

        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)

        #Cylinder along z, we want it to be allong xAxis
        #Solution: use the appropriate rotation matrix
        #We have to choose the right axis, perpendicular to both, and rotate by the appropriate angle, the angle between the 2 vectors

        self.qglColor(QtGui.QColor.fromCmykF(0., 1., 1., 0.))

        rotation_dir = numpy.cross(z_dir,xAxis)
        angle = math.acos(z_dir.dot(xAxis))*180/3.14159

        GL.glPushMatrix()
        GL.glTranslatef(center[0],center[1],center[2])
        GL.glRotatef(angle, rotation_dir[0],rotation_dir[1],rotation_dir[2])
        GLU.gluCylinder(qobj,cyl_radius,cyl_radius,cyl_height,20,20)
        GL.glPopMatrix()

        self.qglColor(QtGui.QColor.fromCmykF(1., 0., 1., 0.))


        rotation_dir = numpy.cross(z_dir,yAxis)
        angle = math.acos(z_dir.dot(yAxis))*180/3.14159

        GL.glPushMatrix()
        GL.glTranslatef(center[0],center[1],center[2])
        GL.glRotatef(angle, rotation_dir[0],rotation_dir[1],rotation_dir[2])
        GLU.gluCylinder(qobj,cyl_radius,cyl_radius,cyl_height,20,20)
        GL.glPopMatrix()


        GL.glEndList()

        return genList 
開發者ID:simnibs,項目名稱:simnibs,代碼行數:51,代碼來源:electrodeGUI.py

示例10: makeObject

# 需要導入模塊: from OpenGL import GL [as 別名]
# 或者: from OpenGL.GL import glGenLists [as 別名]
def makeObject(self):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)

        GL.glBegin(GL.GL_QUADS)

        x1 = +0.06
        y1 = -0.14
        x2 = +0.14
        y2 = -0.06
        x3 = +0.08
        y3 = +0.00
        x4 = +0.30
        y4 = +0.22

        self.quad(x1, y1, x2, y2, y2, x2, y1, x1)
        self.quad(x3, y3, x4, y4, y4, x4, y3, x3)

        self.extrude(x1, y1, x2, y2)
        self.extrude(x2, y2, y2, x2)
        self.extrude(y2, x2, y1, x1)
        self.extrude(y1, x1, x1, y1)
        self.extrude(x3, y3, x4, y4)
        self.extrude(x4, y4, y4, x4)
        self.extrude(y4, x4, y3, x3)

        Pi = 3.14159265358979323846
        NumSectors = 200

        for i in range(NumSectors):
            angle1 = (i * 2 * Pi) / NumSectors
            x5 = 0.30 * math.sin(angle1)
            y5 = 0.30 * math.cos(angle1)
            x6 = 0.20 * math.sin(angle1)
            y6 = 0.20 * math.cos(angle1)

            angle2 = ((i + 1) * 2 * Pi) / NumSectors
            x7 = 0.20 * math.sin(angle2)
            y7 = 0.20 * math.cos(angle2)
            x8 = 0.30 * math.sin(angle2)
            y8 = 0.30 * math.cos(angle2)

            self.quad(x5, y5, x6, y6, x7, y7, x8, y8)

            self.extrude(x6, y6, x7, y7)
            self.extrude(x8, y8, x5, y5)

        GL.glEnd()
        GL.glEndList()

        return genList 
開發者ID:dragondjf,項目名稱:PFramer,代碼行數:53,代碼來源:opengl_test.py


注:本文中的OpenGL.GL.glGenLists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。