本文整理汇总了Python中opengltk.OpenGL.GL.glShadeModel方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glShadeModel方法的具体用法?Python GL.glShadeModel怎么用?Python GL.glShadeModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glShadeModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SetupGL
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glShadeModel [as 别名]
def SetupGL(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Setup OpenGL rendering state for this object
"""
#print "SetupGL", self
if not self.inheritMaterial:
self.InitMaterial()
self.InitColor()
if self.GetLighting():
#glEnable(GL_LIGHTING)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
shading = self.GetShading()
if shading != GL.GL_NONE:
if self.normals is not None:
if (shading==GL.GL_SMOOTH and \
len(self.normals)!=len(self.vertexSet)) or \
(shading==GL.GL_FLAT and \
len(self.normals)!=len(self.faceSet)):
self.GetNormals()
self.viewer.objectsNeedingRedo[self] = None
GL.glShadeModel(shading)
else: # no lighting
GL.glDisable(GL.GL_LIGHTING)
if not self.inheritCulling:
if self.culling in (GL.GL_BACK, GL.GL_FRONT, GL.GL_FRONT_AND_BACK):
GL.glCullFace(self.culling)
GL.glEnable(GL.GL_CULL_FACE)
else: GL.glDisable(GL.GL_CULL_FACE)
if not self.inheritFrontPolyMode:
mode =self.frontPolyMode
if self.frontPolyMode==viewerConst.OUTLINED:
mode = GL.GL_FILL
if self.frontAndBack:
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, mode)
else:
GL.glPolygonMode(GL.GL_FRONT, mode)
if not self.inheritBackPolyMode:
mode = self.backPolyMode
if self.backPolyMode==viewerConst.OUTLINED:
mode = GL.GL_FILL
GL.glPolygonMode(GL.GL_BACK, mode)
#self._AntiAliasing()
self._WidthAndStipple()
示例2: doloop
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glShadeModel [as 别名]
def doloop(self, name, shademodel, cbdisplay, cbreshape, cbkeyboard):
GLUT.glutInit( sys.argv)
GLUT.glutInitDisplayMode( GLUT.GLUT_SINGLE | GLUT.GLUT_RGB)
GLUT.glutInitWindowSize( 500, 500)
GLUT.glutInitWindowPosition( 100, 100)
GLUT.glutCreateWindow( name)
GL.glClearColor( 0.0, 0.0, 0.0, 0.0)
GL.glShadeModel( GL.GL_FLAT)
GLUT.glutDisplayFunc( cbdisplay)
GLUT.glutReshapeFunc( cbreshape)
GLUT.glutKeyboardFunc( cbkeyboard)
GLUT.glutTimerFunc(1000, self.exitloop, 0)
GLUT.glutMainLoop()
示例3:
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glShadeModel [as 别名]
lightTwoPosition = [-40.0, 40, 100.0, 0.0]
lightTwoColor = [0.99, 0.99, 0.99, 1.0]
### initialize glut
GLUT.glutInit (sys.argv)
GLUT.glutInitDisplayMode (GLUT.GLUT_DOUBLE | GLUT.GLUT_RGB | GLUT.GLUT_DEPTH)
GLUT.glutCreateWindow ("join styles")
GLUT.glutDisplayFunc (DrawStuff)
#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)