本文整理汇总了Python中opengltk.OpenGL.GL.glMaterialfv方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glMaterialfv方法的具体用法?Python GL.glMaterialfv怎么用?Python GL.glMaterialfv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glMaterialfv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setMaterial
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glMaterialfv [as 别名]
def setMaterial(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
mat = self.material
GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, mat[self.ambi][0])
diff = mat[self.diff][0]
diff[3] = mat[self.opac][0]
GL.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, mat[self.diff][0])
GL.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, mat[self.spec][0])
GL.glMaterialfv(GL.GL_FRONT, GL.GL_EMISSION, mat[self.emis][0])
GL.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, float(mat[self.shini][0]))
GL.glColor4fv(mat[self.diff][0])
示例2: DisplayFunction
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glMaterialfv [as 别名]
def DisplayFunction(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""display a set of indexed geometric primitives"""
if self.dpyList:
# print "DisplayFunction", self.dpyList, self.fullName
lDrawOutline = (self.getDrawOutlineMode('front'), self.getDrawOutlineMode('back'))
if (lDrawOutline[0] or lDrawOutline[1]) and self.viewer.hasOffsetExt:
outl = self.outline
if self.GetPolyMode('front') == GL.GL_FILL \
or self.GetPolyMode('back') == GL.GL_FILL:
mode = GL.GL_POLYGON_OFFSET_FILL
GL.glEnable(mode)
self.viewer.polyOffset( outl.factor, outl.unit)
Geom.DisplayFunction(self)
GL.glDisable(mode)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
if not outl.colorAsMaterial:
if outl.lighting:
GL.glMaterialfv( GL.GL_FRONT_AND_BACK,
GL.GL_EMISSION,
outl.color )
else:
GL.glDisable(GL.GL_LIGHTING)
GL.glColor4fv (outl.color)
GL.glLineWidth(outl.lineWidth)
if lDrawOutline[0] is False or lDrawOutline[1] is False:
GL.glEnable(GL.GL_CULL_FACE)
if lDrawOutline[0]:
GL.glCullFace(GL.GL_BACK)
elif lDrawOutline[1]:
GL.glCullFace(GL.GL_FRONT)
else:
GL.glDisable(GL.GL_CULL_FACE)
if outl.dpyList:
currentcontext = self.viewer.currentCamera.tk.call(self.viewer.currentCamera._w, 'contexttag')
if currentcontext != outl.dpyList[1]:
warnings.warn("""DisplayFunction failed because the current context is the wrong one""")
#print "currentcontext != outl.dpyList[1]", currentcontext, outl.dpyList[1]
else:
#print '#%d'%outl.dpyList[0], currentcontext, "glCallList IndexedGeom"
GL.glCallList(outl.dpyList[0])
GL.glEnable(GL.GL_CULL_FACE)
GL.glEnable(GL.GL_LIGHTING)
else:
Geom.DisplayFunction(self)
else:
Geom.DisplayFunction(self)