本文整理汇总了Python中opengltk.OpenGL.GL.glLightfv方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glLightfv方法的具体用法?Python GL.glLightfv怎么用?Python GL.glLightfv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glLightfv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glLightfv [as 别名]
#GLUT.glutMotionFunc (MouseMotion)
# initialize GL
GL.glClearDepth (1.0)
GL.glEnable (GL.GL_DEPTH_TEST)
GL.glClearColor (0.0, 0.0, 0.0, 0.0)
GL.glShadeModel (GL.GL_SMOOTH)
GL.glMatrixMode (GL.GL_PROJECTION)
# roughly, measured in centimeters
GL.glFrustum (-9.0, 9.0, -9.0, 9.0, 50.0, 150.0)
GL.glMatrixMode(GL.GL_MODELVIEW)
# initialize lighting
GL.glLightfv (GL.GL_LIGHT0, GL.GL_POSITION, lightOnePosition)
GL.glLightfv (GL.GL_LIGHT0, GL.GL_DIFFUSE, lightOneColor)
GL.glEnable (GL.GL_LIGHT0)
GL.glLightfv (GL.GL_LIGHT1, GL.GL_POSITION, lightTwoPosition)
GL.glLightfv (GL.GL_LIGHT1, GL.GL_DIFFUSE, lightTwoColor)
GL.glEnable (GL.GL_LIGHT1)
GL.glEnable (GL.GL_LIGHTING)
GL.glEnable (GL.GL_NORMALIZE)
GL.glColorMaterial (GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE)
GL.glEnable (GL.GL_COLOR_MATERIAL)
InitStuff ()
GLUT.glutKeyboardFunc(keyboard)
print "Type 'q' in the demo window to quit"
GLUT.glutMainLoop ()
示例2: setupLightModel
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glLightfv [as 别名]
def setupLightModel(self):
"""
"""
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
# this method has to be called explicitly by the derived classes if
# a default lighting model is wanted
GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, [1.0, 1.0, 1.0, 0.0]);
GL.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, [.5, .5, .5, 1.0])
GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, [-1.0, 1.0, 1.0, 0.0]);
GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, [0.2, 0.2, 0.2, 1.0])
#GL.glEnable(GL.GL_LIGHTING)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
GL.glEnable(GL.GL_LIGHT0)
GL.glEnable(GL.GL_LIGHT1)