本文整理汇总了Python中opengltk.OpenGL.GL.glMaterialWithCheck方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glMaterialWithCheck方法的具体用法?Python GL.glMaterialWithCheck怎么用?Python GL.glMaterialWithCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glMaterialWithCheck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DisplayFunction
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glMaterialWithCheck [as 别名]
def DisplayFunction(self):
"""Draw a square with diagonals to represent the clipping plane
"""
#print "ClippingPlane.DisplayFunction"
#trans = self.eqn[3]*(self.eqn[:3]*self.n)
resetMaterialMemory()
trans = self.translation
GL.glPushMatrix()
#GL.glTranslatef(-trans[0],-trans[1],-trans[2])
GL.glTranslatef(float(trans[0]),
float(trans[1]),
float(trans[2]))
GL.glMultMatrixf(self.rotation)
GL.glScalef(float(self.scale[0]),
float(self.scale[1]),
float(self.scale[2]))
if self.polyMode == GL.GL_QUADS:
GL.glPushAttrib(GL.GL_CURRENT_BIT | GL.GL_LIGHTING_BIT |
GL.GL_POLYGON_BIT)
GL.glDisable(GL.GL_LIGHTING)
GL.glMaterialWithCheck(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT,
self.color)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
GL.glPushMatrix()
GL.glMultMatrixf(self.planeRot)
GL.glBegin (GL.GL_QUADS)
GL.glVertex3f (0.0, -5.0, -5.0)
GL.glVertex3f (0.0, -5.0, 5.0)
GL.glVertex3f (0.0, 5.0, 5.0)
GL.glVertex3f (0.0, 5.0, -5.0)
GL.glVertex3f (0.0, -5.0, -5.0)
GL.glEnd ()
GL.glPopMatrix()
GL.glPopAttrib()
else:
# MS disabling GL.GL_BLEND breaks display of transparent surfaces
## if self.antialiased==True:
## GL.glEnable(GL.GL_LINE_SMOOTH)
## GL.glEnable(GL.GL_BLEND)
## else:
## GL.glDisable(GL.GL_LINE_SMOOTH)
## GL.glDisable(GL.GL_BLEND)
GL.glColor4fv (self.color)
GL.glLineWidth(self.lineWidth)
GL.glPushMatrix()
GL.glMultMatrixf(self.planeRot)
# could and should be a display list made once for all planes
GL.glBegin (GL.GL_LINE_STRIP)
GL.glVertex3f (0.0, -5.0, -5.0)
GL.glVertex3f (0.0, -5.0, 5.0)
GL.glVertex3f (0.0, 5.0, 5.0)
GL.glVertex3f (0.0, 5.0, -5.0)
GL.glVertex3f (0.0, -5.0, -5.0)
GL.glVertex3f (0.0, 5.0, 5.0)
GL.glVertex3f (0.0, -5.0, 5.0)
GL.glVertex3f (0.0, 5.0, -5.0)
GL.glEnd ()
GL.glPopMatrix()
GL.glPopMatrix()