本文整理汇总了Python中opengltk.OpenGL.GL.glGetDoublev方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glGetDoublev方法的具体用法?Python GL.glGetDoublev怎么用?Python GL.glGetDoublev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glGetDoublev方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: trRasterPos3f
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def trRasterPos3f(self, x, y, z):
"""
Replacement for glRastePos3f() which avoids the problem with invalid
raster pos.
"""
if self.CurrentTile<0:
# not doing tile rendering right now. Let OpenGL do this.
GL.glRasterPos3f(float(x), float(y), float(z))
else:
# Get modelview, projection and viewport
modelview = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)
proj = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX)
viewport = [0, 0, self.CurrentTileWidth, self.CurrentTileHeight]
示例2: ConcatRotation
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def ConcatRotation(self, matrix, redo=1):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Apply the rotation matrix to the object [matrix.shape==(16,)]"""
if self.redirectXform: obj = self.redirectXform
else: obj = self
obj._modified = True
GL.glPushMatrix()
GL.glLoadIdentity()
GL.glMultMatrixf(obj.Ri)#.astype('f'))
GL.glMultMatrixf(matrix)
GL.glMultMatrixf(obj.R)#.astype('f'))
GL.glMultMatrixf(obj.rotation)
m = Numeric.array(GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)).astype('f')
obj.rotation = glCleanRotMat(m).astype('f')
obj.rotation.shape = (16, )
GL.glPopMatrix()
for o in self.copyXform: o.ConcatRotation(matrix)
## This code made rotation very slow because it would rebuild the
## master dpyList in cases where it was not needed
## if redo and not self.immediateRendering:
## vi = self.viewer
## print 'faga'
## vi.deleteOpenglList()
vi = self.viewer
if vi.activeClippingPlanes > 0 or vi.activeScissor > 0 or \
(vi.currentObject!=vi.rootObject and not \
vi.redirectTransformToRoot) and redo and \
not self.immediateRendering:
vi.deleteOpenglList()
示例3: GetMatrix
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def GetMatrix(self, root=None, instance=None, scale=True, transpose=True):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Returns the matrix by which this object is transformed
scale = False: returns the rotation and translation. no scaling info included
Used to save the transformed geom --> coords --> new pdb file
instance is a list of integer instance indices for all parents
"""
if root is None:
root = self.viewer.rootObject
if instance is None:
instance = [0]
p = self.parent
while p:
instance.append(0)
p = p.parent
GL.glPushMatrix()
GL.glLoadIdentity()
#print 'GetMatrix', instance
self.BuildMat(self, root, scale, instance)
#GL.glMultMatrixf(self.instanceMatricesFortran[instanceList[0]]])
m = Numeric.array(GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)).astype('f')
GL.glPopMatrix()
if Numeric.alltrue(m==Numeric.zeros(16).astype('f')):
# this happens when Pmv has no GUI
m = Numeric.identity(4)
if transpose:
return Numeric.transpose(Numeric.reshape(m, (4,4)))
else:
return Numeric.reshape(m, (4,4))
示例4: _loopGeomsRec
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def _loopGeomsRec(self, obj):
""" recursive method """
GL.glPushMatrix()
# we discard root object transformation:
if obj is not obj.viewer.rootObject:
if hasattr(obj, 'MakeMat'):
obj.MakeMat()
obj.VRML2CreatedPROTOForThisGeom = 0 # flag used in vrml2 doit()
for i in range(len(obj.instanceMatricesFortran)):
GL.glPushMatrix()
GL.glMultMatrixf(obj.instanceMatricesFortran[i])
obj.instanceMatricesFortranIndex = i # flag used in stl and vrml2 doit()
matrix = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)
self.NodeRepr(obj, matrix)
for child in obj.children:
if child.visible:
self._loopGeomsRec(child)
GL.glPopMatrix()
GL.glPopMatrix() # Restore the matrix
del obj.instanceMatricesFortranIndex # clean up object
del obj.VRML2CreatedPROTOForThisGeom
示例5: ConcatRotationRelative
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def ConcatRotationRelative(self, matrix):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Apply the rotation matrix to the object (matrix.shape ==(16,)
Unlike ConcatRotation you just concatenate the rotation of the object
without considering Ri and R
"""
self._modified = True
obj = self
GL.glPushMatrix()
GL.glLoadIdentity()
## GL.glMultMatrixf(obj.rotation)
GL.glMultMatrixf(matrix)
GL.glMultMatrixf(obj.rotation)
m = Numeric.array(GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)).astype('f')
obj.rotation = m.astype('f')
obj.rotation.shape = (16, )
GL.glPopMatrix()
示例6: FrameTransform
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def FrameTransform(self, camera=None):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Build the R an RI, the object's frame transformation and inverse"""
GL.glPushMatrix()
self.Si = Numeric.ones( (3, ) )
GL.glLoadIdentity()
if hasattr(self, 'parent'):
if self.inheritXform:
parent = self.parent
while (parent):
m = Numeric.reshape( parent.rotation, (4,4) )
upd = Numeric.reshape( Numeric.transpose(m), (16, ) )
GL.glMultMatrixf(upd)
GL.glMultMatrixf(parent.MatrixRotInv)
self.Si = self.Si / parent.scale
self.Si = self.Si / parent.MatrixScale
# we have to test here because we need to take into
# account the first parent that does not inherit while
# building R and Ri
if not parent.inheritXform:
break
parent = parent.parent
if camera:
m = Numeric.reshape( camera.rotation, (4,4) )
upd = Numeric.reshape( Numeric.transpose(m), (16, ) )
GL.glMultMatrixf(upd)
self.Si = self.Si / camera.scale
self.Ri = Numeric.array(GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)).astype('f')
GL.glPopMatrix()
self.Ri = glCleanRotMat(self.Ri).astype('f')
self.Ri.shape = (4,4)
self.R = Numeric.reshape( Numeric.transpose(self.Ri), (16, ) ).astype('f')
self.Ri.shape = (16, )
if self.redirectXform: self.redirectXform.FrameTransform(camera)
for o in self.copyXform: o.FrameTransform(camera)
示例7: FrameTransform
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glGetDoublev [as 别名]
def FrameTransform(self, camera=None):
"""Build the R an RI, the object's frame transformation and inverse"""
GL.glPushMatrix()
self.Si = Numeric.ones( (3, ) )
GL.glLoadIdentity()
m = Numeric.reshape( self.object.rotation, (4,4) )
upd = Numeric.reshape( Numeric.transpose(m), (16, ) )
GL.glMultMatrixf(self.object.Ri)
GL.glMultMatrixf(upd)
GL.glMultMatrixf(self.object.MatrixRotInv)
self.Si = self.Si * self.object.Si / (self.object.scale *
self.object.MatrixScale)
self.Ri = Numeric.array(GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)).astype('f')
GL.glPopMatrix()
#self.Ri = Numeric.reshape(glCleanRotMat(self.Ri), (4,4) )
self.Ri = glCleanRotMat(self.Ri)
self.R = Numeric.reshape( Numeric.transpose(self.Ri), (16, ) ).astype('f')
self.Ri = Numeric.reshape(self.Ri, (16, )).astype('f')
if self.redirectXform: self.redirectXform.FrameTransform(camera)
for o in self.copyXform: o.FrameTransform(camera)