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


Python GL.GL_COMPILE属性代码示例

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


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

示例1: drawIndicator

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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: makeList

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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

示例3: __init__

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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

示例4: drawEEGPositions

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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

示例5: makeArrayList

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [as 别名]
def makeArrayList(self, chunkPosition, showRedraw):
        l = gl.glGenLists(1)
        GL.glNewList(l, GL.GL_COMPILE)
        self.drawArrays(chunkPosition, showRedraw)
        GL.glEndList()
        return l 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:8,代码来源:renderer.py

示例6: compileList

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [as 别名]
def compileList(self):
        GL.glNewList(self._displayList, GL.GL_COMPILE)
        self._draw()
        GL.glEndList()
        self.invalidList = False 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:7,代码来源:drawable.py

示例7: createGLDisplayList

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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

示例8: drawPointAndDirs

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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

示例9: create_axes_list

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [as 别名]
def create_axes_list(self):
        '''Creates display lists to render unit length x,y,z axes.'''
        import OpenGL.GL as gl
        gl.glNewList(self.gllist_id, gl.GL_COMPILE)
        gl.glBegin(gl.GL_LINES)
        gl.glColor3f(1.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(1.0, 0.0, 0.0)
        gl.glColor3f(0.0, 1.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 1.0, 0.0)
        gl.glColor3f(-.0, 0.0, 1.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 1.0)

        gl.glColor3f(1.0, 1.0, 1.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(-1.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(0.0, -1.0, 0.0)
        gl.glVertex3f(0.0, 0.0, 0.0)
        gl.glVertex3f(0.0, 0.0, -1.0)
        gl.glEnd()

        def label_axis(x, y, z, label):
            gl.glRasterPos3f(x, y, z)
            glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_18,
                                  str(label))
        def label_axis_for_feature(x, y, z, feature_ind):
            feature = self.octant_features[feature_ind[0]][feature_ind[1]]
            label_axis(x, y, z, self.labels[feature])

        if self._have_glut:
            try:
                import OpenGL.GLUT as glut
                if bool(glut.glutBitmapString):
                    if self.quadrant_mode == 'independent':
                        label_axis(1.05, 0.0, 0.0, 'x')
                        label_axis(0.0, 1.05, 0.0, 'y')
                        label_axis(0.0, 0.0, 1.05, 'z')
                    elif self.quadrant_mode == 'mirrored':
                        label_axis_for_feature(1.05, 0.0, 0.0, (0, 0))
                        label_axis_for_feature(0.0, 1.05, 0.0, (0, 1))
                        label_axis_for_feature(0.0, 0.0, 1.05, (0, 2))
                        label_axis_for_feature(-1.05, 0.0, 0.0, (6, 0))
                        label_axis_for_feature(0.0, -1.05, 0.0, (6, 1))
                        label_axis_for_feature(0.0, 0.0, -1.05, (6, 2))
                    else:
                        label_axis_for_feature(1.05, 0.0, 0.0, (0, 0))
                        label_axis_for_feature(0.0, 1.05, 0.0, (0, 1))
                        label_axis_for_feature(0.0, 0.0, 1.05, (0, 2))
            except:
                pass
        gl.glEndList() 
开发者ID:spectralpython,项目名称:spectral,代码行数:56,代码来源:ndwindow.py

示例10: makeObject

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COMPILE [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.GL_COMPILE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。