本文整理汇总了Python中opengltk.OpenGL.GL.glVertex3dv方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glVertex3dv方法的具体用法?Python GL.glVertex3dv怎么用?Python GL.glVertex3dv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glVertex3dv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3dv [as 别名]
def Draw(self):
#print"Box.Draw"
self.oldFPM = self.frontPolyMode
if self.frontPolyMode == GL.GL_LINE:
GL.glDisable(GL.GL_LIGHTING)
#c is 8x3 array
c= self.vertexSet.vertices.array
#lines parallel to x-axis should be red, y->blue and z->green
col = ((1,0,0),(0,1,0),(0,0,1))
#these groups of 4 pairs of points define lines parallel to x, y, and z axes
alines=[[(c[0],c[1]),(c[2],c[3]),(c[4],c[5]),(c[6],c[7])],
[(c[0],c[3]),(c[1],c[2]),(c[4],c[7]),(c[5],c[6])],
[(c[0],c[4]),(c[1],c[5]),(c[3],c[7]),(c[2],c[6])]]
namectr=0
for i in range(3):
if not self.inheritMaterial:
GL.glColor3fv(col[i])
for vpairs in alines[i]:
GL.glPushName(namectr)
GL.glBegin(GL.GL_LINES)
GL.glVertex3dv(list(vpairs[0]))
GL.glVertex3dv(list(vpairs[1]))
GL.glEnd()
GL.glPopName()
namectr=namectr+1
self.viewer.enableOpenglLighting()
return 1
else:
return IndexedPolygons.Draw(self)
示例2: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3dv [as 别名]
#.........这里部分代码省略.........
glMaterialWithCheck( GL.GL_BACK, propConst[j],
backMat[j][0] )
self.isNewColor()
#self.isNewMaterial(0,0,0)
n = self.normals
# loop over each strip
for stripNum in range(1,len(self.stripBegin)):
c = vert[self.stripBegin[stripNum-1]:self.stripBegin[stripNum]]
GL.glPushName(stripNum)
GL.glBegin(GL.GL_QUAD_STRIP)
# per part material properties
if frontMat:
if frontMatBind[noCol] == PER_PART:
if self.isNewColor(c=frontMat[noCol][stripNum-1]):
GL.glColor4fv(frontMat[noCol][stripNum-1])
if n:
if frontMat:
for j in range(5):
if frontMatBind[j]==PER_PART:
glMaterialWithCheck( face,
propConst[j],
frontMat[j][stripNum-1] )
if backMat and not self.frontAndBack:
for j in range(5):
if backMatBind[j] == PER_PART:
glMaterialWithCheck( GL.GL_BACK,
propConst[j],
backMat[j][stripNum-1] )
# loop over each vertex in a strip
i = 0
for v in c:
if n:
if self.shading==GL.GL_FLAT:
if i > 1 and i%2==0:
GL.glNormal3dv(n[(self.stripBegin[stripNum-1]+i-(2*stripNum))/2])
elif self.shading==GL.GL_SMOOTH:
GL.glNormal3dv(n[self.stripBegin[stripNum-1]+i])
else:
pass
# per face (per triangle) material properties
if not n:
if frontMat:
if frontMatBind[noCol] == PER_FACE:
if i > 1 and i%2==0:
if self.isNewColor(c=frontMat[noCol][(self.stripBegin[stripNum-1]+i-(2*stripNum))/2]):
GL.glColor4fv(frontMat[noCol][(self.stripBegin[stripNum-1]+i-(2*stripNum))/2])
else:
if frontMat:
for k in range(5):
if frontMatBind[k] == PER_FACE:
if i > 1 and i%2==0:
glMaterialWithCheck( face,
propConst[k],
frontMat[k][(self.stripBegin[stripNum-1]+i-(2*stripNum))/2] )
if backMat and not self.frontAndBack:
for k in range(5):
if backMatBind[k] == PER_FACE:
if i > 1 and i%2==0:
glMaterialWithCheck( GL.GL_BACK,
propConst[k],
backMat[k][(self.stripBegin[stripNum-1]+i-(2*stripNum))/2] )
# per vertex material properties
if not n:
if frontMat:
if frontMatBind[noCol] == PER_VERTEX:
if self.isNewColor(c=frontMat[noCol][self.stripBegin[stripNum-1]+i]):
GL.glColor4fv(frontMat[noCol][self.stripBegin[stripNum-1]+i])
else:
if frontMat:
for k in range(5):
if frontMatBind[k] == PER_VERTEX:
glMaterialWithCheck( face, propConst[k],
frontMat[k][self.stripBegin[stripNum-1]+i] )
if backMat and not self.frontAndBack:
for k in range(5):
if backMatBind[k] == PER_VERTEX:
glMaterialWithCheck( GL.GL_BACK,
propConst[k],
backMat[k][self.stripBegin[stripNum-1]+i] )
# draw vertex
GL.glVertex3dv(v)
i = i + 1
GL.glEnd()
GL.glPopName()
return 1