本文整理汇总了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()
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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()
示例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()
示例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
示例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)
示例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()