当前位置: 首页>>代码示例>>Python>>正文


Python GL.glClearColor方法代码示例

本文整理汇总了Python中opengltk.OpenGL.GL.glClearColor方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glClearColor方法的具体用法?Python GL.glClearColor怎么用?Python GL.glClearColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opengltk.OpenGL.GL的用法示例。


在下文中一共展示了GL.glClearColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: display

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [as 别名]
    def display(self):
	GL.glClearColor( 0.0, 0.0, 0.0, 0.0)
	GL.glClear( GL.GL_COLOR_BUFFER_BIT)
	GL.glColor3f( 1.0,1.0,0.0)
	self.x = self.x + self.move_x
	self.y = self.y + self.move_y
	self.age = self.age + 1
	which = Numeric.greater( self.age, MAX_AGE)
	self.x = Numeric.choose( which, (self.x, RandomArray.random( NUMDOTS)))
	selfy = Numeric.choose( which, (self.y, RandomArray.random( NUMDOTS)))
	self.age = Numeric.choose( which, (self.age, 0))
	self.x = Numeric.choose( Numeric.greater( self.x, 1.0), (self.x, self.x - 1.0)) 
	self.y = Numeric.choose( Numeric.greater( self.y, 1.0), (self.y, self.y - 1.0))
	x2 = RandomArray.random( NUMDOTS2)
	y2 = RandomArray.random( NUMDOTS2)
	v = Numeric.concatenate(
		(Numeric.transpose( Numeric.array( [self.x, self.y])),
		 Numeric.transpose( Numeric.array( [self.x - 0.005, self.y + 0.005])),
		 Numeric.transpose( Numeric.array( [self.x + 0.005, self.y - 0.005])),
		 Numeric.transpose( Numeric.array( [x2, y2]))))
        #from opengltk.util import GLdouble
        #av = bufarray.readArray( v, GLdouble)
	#GL.glVertexPointer( 2, av)
        GL.glVertexPointer( 2, v)
	GL.glEnableClientState( GL.GL_VERTEX_ARRAY)
	#glplus.DrawArrays( GL.POINTS, len( av))
        from opengltk import  glplus
        glplus.DrawArrays( GL.GL_POINTS, len( v))
	#GL.glDisableClientState( GL.VERTEX_ARRAY)
	GL.glFlush()
	GLUT.glutSwapBuffers()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:33,代码来源:test_dots.py

示例2: doloop

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [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()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:16,代码来源:test_cube.py

示例3: redraw

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [as 别名]
    def redraw(self):
        """ redraw the Material editor opengl sphere that shows the effect
of the modifications
"""
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()

        self.tk.call(self._w, 'makecurrent')
        GL.glClearColor(0,0,0,0)
        self.initProjection()
        self.Configure()
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)

        """ draw the black background squares """
        GL.glDisable( GL.GL_LIGHTING )
        GL.glColor3f( 0.1, 0.1, 0.1 )
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3f(-2, 0, 2); GL.glVertex3f(-2, 2, 2)
        GL.glVertex3f( 0, 2, 2); GL.glVertex3f( 0, 0, 2)
        GL.glEnd()
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3f( 0,-2, 2); GL.glVertex3f( 0, 0, 2)
        GL.glVertex3f( 2, 0, 2); GL.glVertex3f( 2,-2, 2)
        GL.glEnd()

        """ draw the grey background squares """
        GL.glColor3f( 0.3, 0.3, 0.3 )
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3f(-2,-2, 2); GL.glVertex3f(-2, 0, 2)
        GL.glVertex3f( 0, 0, 2); GL.glVertex3f( 0,-2, 2)
        GL.glEnd()
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3f( 0, 0, 2); GL.glVertex3f( 0, 2, 2)
        GL.glVertex3f( 2, 2, 2); GL.glVertex3f( 2, 0, 2)
        GL.glEnd()

        """ enable the sphere transparancy """
        GL.glEnable(GL.GL_BLEND)
        GL.glDepthMask(GL.GL_FALSE)
        GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)

        """ draw the sphere """
        #GL.glEnable(GL.GL_LIGHTING)
        if self.viewer is not None:
            self.viewer.enableOpenglLighting()
        self.setMaterial()
        extractedGlutSolidSphere(1.6, 30, 30, 0)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:49,代码来源:MaterialEditor.py

示例4: redraw

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [as 别名]
    def redraw(self, event=None, filter=None):
        if self.imarray is None:
            return
        if filter:
            self.master.lift()
            GL.glConvolutionFilter2D(GL.GL_CONVOLUTION_2D, GL.GL_LUMINANCE,
                                     3, 3, GL.GL_LUMINANCE, GL.GL_FLOAT,
                                     filter)
##             GL.glConvolutionParameterfv(GL.GL_CONVOLUTION_2D,
##                                        GL.GL_CONVOLUTION_FILTER_SCALE,
##                                        (3., 3.,3.,3.))
##             s=  self.scale
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_RED_SCALE, s)
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_BLUE_SCALE, s)
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_GREEN_SCALE, s)
##             s = self.bias
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_RED_BIAS, s)
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_BLUE_BIAS, s)
##             GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_GREEN_BIAS, s)
##                                        GL.GL_CONVOLUTION_FILTER_SCALE,
##                                        (3., 3.,3.,3.))
##             GL.glConvolutionParameteriv(GL.GL_CONVOLUTION_2D,
##                                        GL.GL_CONVOLUTION_FILTER_BIAS,
##                                        (1500, 1500, 1500, 1500))
            GL.glEnable(GL.GL_CONVOLUTION_2D)
            
        self.tk.call(self._w, 'makecurrent')
        GL.glClearColor(0.0, 0.0, 0.0, 0.0)
        GL.glClear(GL.GL_COLOR_BUFFER_BIT)
        GL.glRasterPos2i( 0, 0)
        GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
        if self.mode=='RGB':
            _gllib.glDrawPixels( self.width, self.height,
                                 GL.GL_RGB, GL.GL_UNSIGNED_BYTE, self.imarray)
        elif self.mode in ['L','P']:
            _gllib.glDrawPixels( self.width, self.height,
                                 GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE,
                                 self.imarray)

        GL.glDisable(GL.GL_CONVOLUTION_2D)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:42,代码来源:imageViewer.py

示例5: initGL

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [as 别名]
 def initGL(self):
     GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
     GL.glClearColor(0.4, 0.4, 0.4, 0.0)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:5,代码来源:imageViewer.py

示例6:

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glClearColor [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)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:32,代码来源:test.py


注:本文中的opengltk.OpenGL.GL.glClearColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。