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


Python GL.glCallList方法代码示例

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


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

示例1: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def paintGL(self, f=1.0):
        """ 
        Assumes a current GL context.  Assumes that context has been transformed so the
        view runs from (0,0) to page width & height with (0,0) in the bottom left corner.
        """

        if self.isDirty:
            self.resetPixmap()
            if self.nextCSIIsDirty:
                nextStep = self.parentItem().getNextStep()
                if nextStep:
                    nextStep.csi.isDirty = nextStep.csi.nextCSIIsDirty = True
                self.nextCSIIsDirty = False

        LicGLHelpers.pushAllGLMatrices()

        pos = self.mapToItem(self.getPage(), self.mapFromParent(self.pos()))
        dx = pos.x() + (self.rect().width() / 2.0) + self.center.x()
        dy = -self.getPage().PageSize.height() + pos.y() + (self.rect().height() / 2.0) + self.center.y()
        LicGLHelpers.rotateToView(CSI.defaultRotation, CSI.defaultScale * self.scaling * f, dx * f, dy * f, 0.0)
        LicGLHelpers.rotateView(*self.rotation)

        GL.glCallList(self.glDispID)
        LicGLHelpers.popAllGLMatrices() 
开发者ID:remig,项目名称:lic,代码行数:26,代码来源:LicModel.py

示例2: add_object_seg

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def add_object_seg(filename, xyz, unit, up_string, front_string, center, angle, size, segment_id, obj_info, layout_type=None):
    GL.glPushMatrix()
    x = xyz[0]
    y = xyz[1]
    z = xyz[2]
    # translate in view
    if layout_type is not None:
        GL.glTranslatef(center[0], center[1], center[2])
    else:
        GL.glTranslatef(center[0], center[1], center[2] - size[2] / 2)
    GL.glRotate(angle, 0, 1, 0)
    GL.glScalef(size[0] * 100 / x, size[1] * 100 / y, size[2] * 100 / z)
    # normalize directions, rotate object to front: front -> 0,0,1 | up -> 0,1,0
    alignment = align_directions(up_string, front_string)
    if not alignment:
        GL.glPopMatrix()
        return
    # obj = OBJ_NORMAL(filename, swapyz=False)
    obj = OBJ_SEG(obj_info['info'], color=[segment_id / 255.0, 0.0, 0.0], swapyz=False)
    GL.glCallList(obj.gl_list)
    GL.glPopMatrix()


# angle is the object rotation angle 
开发者ID:thusiyuan,项目名称:holistic_scene_parsing,代码行数:26,代码来源:render_scene.py

示例3: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glLoadIdentity()
        GL.glTranslated(0.0, 0.0, -10.0)
        GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
        GL.glScalef(self.zoom,self.zoom,self.zoom)

        GL.glCallList(self.electrode_object)
        GL.glCallList(self.center_dir)
        if self.plug_object != 0:
            GL.glCallList(self.plug_object) 
开发者ID:simnibs,项目名称:simnibs,代码行数:15,代码来源:electrodeGUI.py

示例4: draw_data_set

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def draw_data_set(self):
        '''Draws the N-D data set in the scene.'''
        import OpenGL.GL as gl
        for i in range(1, 9):
            gl.glCallList(self.gllist_id + i) 
开发者ID:spectralpython,项目名称:spectral,代码行数:7,代码来源:ndwindow.py

示例5: draw

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

示例6: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glLoadIdentity()
        GL.glTranslated(0.0, 0.0, -10.0)
        GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
        GL.glCallList(self.object) 
开发者ID:dragondjf,项目名称:PFramer,代码行数:10,代码来源:opengl_test.py

示例7: __callPreviousGLDisplayLists

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def __callPreviousGLDisplayLists(self, isCurrent=False):

        # Call all previous step's CSI display list
        prevStep = self.parentItem().getPrevStep()
        if prevStep:
            # if prevStep.csi.glDispID == LicGLHelpers.UNINIT_GL_DISPID:
            prevStep.csi.__callPreviousGLDisplayLists(False)
            # else:
            #    GL.glCallList(prevStep.csi.glDispID)

        # Draw all the parts in this CSI
        # First their edges
        GL.glPushAttrib(GL.GL_CURRENT_BIT | GL_ENABLE_BIT)
        GL.glColor4f(0.0, 0.0, 0.0, 1.0)
        GL.glDisable(GL_LIGHTING)
        
        for partItem in self.parts:
            for part in partItem.parts:
                part.callGLDisplayList(isCurrent, True)
                
        GL.glPopAttrib()
        
        # Than their contents
        for partItem in self.parts:
            for part in partItem.parts:
                part.callGLDisplayList(isCurrent, False) 
开发者ID:remig,项目名称:lic,代码行数:28,代码来源:LicModel.py

示例8: callGLDisplayList

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def callGLDisplayList(self, useDisplacement=False):
        if not useDisplacement:
            return

        # Must be called inside a glNewList/EndList pair
        if self.color is not None:
            color = list(self.color.rgba)
            if self.isSelected():
                color[3] *= 0.6
            GL.glPushAttrib(GL.GL_CURRENT_BIT)
            GL.glColor4fv(color)

        matrix = list(self.matrix)
        if self.displacement:
            matrix[12] += self.displacement[0]
            matrix[13] += self.displacement[1]
            matrix[14] += self.displacement[2]
        GL.glPushMatrix()
        GL.glMultMatrixf(matrix)

        # LicGLHelpers.drawCoordLines()
        self.doGLRotation()

        if self.isSelected():
            self.drawGLBoundingBox()

        GL.glCallList(self.abstractPart.glDispID)
        GL.glPopMatrix()

        if self.color is not None:
            GL.glPopAttrib() 
开发者ID:remig,项目名称:lic,代码行数:33,代码来源:LicModel.py

示例9: add_object_normal

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def add_object_normal(filename, xyz, unit, up_string, front_string, center, angle, size, beta, obj_info, layout_type=None):
    GL.glPushMatrix()
    x = xyz[0]
    y = xyz[1]
    z = xyz[2]
    del rotation_matrix_list[:]
    # translate in view
    if layout_type is not None:
        GL.glTranslatef(center[0], center[1], center[2])
    else:
        GL.glTranslatef(center[0], center[1], center[2] - size[2] / 2)
    GL.glRotate(angle, 0, 1, 0)
    rotation_matrix_list.append(rotation_matrix(angle, 0, 1, 0))
    # scale object
    GL.glScalef(size[0] * 100 / x, size[1] * 100 / y, size[2] * 100 / z)
    # normalize directions, rotate object to front: front -> 0,0,1 | up -> 0,1,0
    alignment = align_directions(up_string, front_string)
    if not alignment:
        GL.glPopMatrix()
        return
    rm = np.identity(3)
    for i in range(len(rotation_matrix_list) - 1, -1, -1):
        rm = rotation_matrix_list[i].dot(rm)
    rm = rotation_matrix(beta, 1, 0, 0).dot(rm)
    obj = OBJ_NORMAL(obj_info['info'], rotation_matrix=rm, swapyz=False, layout_type=layout_type)
    GL.glCallList(obj.gl_list)
    GL.glPopMatrix() 
开发者ID:thusiyuan,项目名称:holistic_scene_parsing,代码行数:29,代码来源:render_scene.py

示例10: add_object

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def add_object(filename, xyz, unit, up_string, front_string, center, angle, size, obj_color, obj_info, layout_type=None):  # x_min,y_min,z_min,x_max,y_max,z_max
    GL.glPushMatrix()
    # after unit conversion...
    x = xyz[0]
    y = xyz[1]
    z = xyz[2]
    # print center, size
    # translate in view
    if layout_type is not None:
        GL.glTranslatef(center[0], center[1], center[2])
    else:
        GL.glTranslatef(center[0], center[1], center[2] - size[2] / 2)
    GL.glRotate(angle, 0, 1, 0)
    GL.glScalef(size[0] * 100 / x, size[1] * 100 / y, size[2] * 100 / z)   # x,y,z y is up
    # normalize directions, rotate object to front: front -> 0,0,1 | up -> 0,1,0
    alignment = align_directions(up_string, front_string)
    if not alignment:
        GL.glPopMatrix()
        return
    # obj = OBJ_NORMAL(filename, swapyz=False)
    obj = OBJ(obj_info['info'], obj_color=obj_color, swapyz=False)
    GL.glCallList(obj.gl_list)
    GL.glPopMatrix()


# read metadata info from csv file 
开发者ID:thusiyuan,项目名称:holistic_scene_parsing,代码行数:28,代码来源:render_scene.py

示例11: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glMatrixMode(GL.GL_PROJECTION)
        GL.glLoadIdentity()
        width = float(self.width())
        height = float(self.height())
        frustrumx = 60*width/self.sizeHint().width()
        frustrumy = 60*height/self.sizeHint().height()
        GL.glFrustum(-frustrumx, frustrumx, frustrumy, -frustrumy, 200, 500)
        GL.glMatrixMode(GL.GL_MODELVIEW)

        self.drawAxis()

        GL.glLoadIdentity()
        GL.glTranslatef(self.xTran, self.yTran, self.zTran)
        GL.glRotatef(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotatef(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotatef(self.zRot / 16.0, 0.0, 0.0, 1.0)
        GL.glScalef(-self.zoom,self.zoom,self.zoom)

        if self.model != 0:
            GL.glCallList(self.model)

        if self.indicator:
            GL.glCallList(self.indicator)

        for stimulator in self.stimulator_objects:
            try:
                GL.glCallList(stimulator)
            except:
                pass

        for tmp in self.tmp_objects:
            try:
                GL.glCallList(tmp)
            except:
                pass

        try:
            GL.glCallList(self.eegReferences)
        except:
            pass

        try:
            GL.glCallList(self.eegPositions)
        except:
            pass

        self.model_matrix = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)
        self.projection_matrix = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX) 
开发者ID:simnibs,项目名称:simnibs,代码行数:52,代码来源:head_model_OGL.py

示例12: on_paint

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glCallList [as 别名]
def on_paint(self, event):
        '''Renders the entire scene.'''
        import OpenGL.GL as gl
        import OpenGL.GLU as glu

        self.canvas.SetCurrent(self.canvas.context)
        if not self.gl_initialized:
            self.initgl()
            self.gl_initialized = True
            self.print_help()
            self.resize(*self.size)

        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity()
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        while len(self._display_commands) > 0:
            self._display_commands.pop(0)()

        if self._refresh_display_lists:
            self.create_display_lists()

        gl.glPushMatrix()
        # camera_pos_rtp is relative to target position. To get the absolute
        # camera position, we need to add the target position.
        camera_pos_xyz = np.array(rtp_to_xyz(*self.camera_pos_rtp)) \
            + self.target_pos
        glu.gluLookAt(
            *(list(camera_pos_xyz) + list(self.target_pos) + self.up))

        if self.show_axes_tf:
            gl.glCallList(self.gllist_id)

        self.draw_data_set()

        gl.glPopMatrix()
        gl.glFlush()

        if self._selection_box is not None:
            self.draw_box(*self._selection_box)

        self.SwapBuffers()
        event.Skip() 
开发者ID:spectralpython,项目名称:spectral,代码行数:45,代码来源:ndwindow.py


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