galaxy.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:gravity 作者: appleminis 项目源码 文件源码
def paintGL(self):
        """Paint the scene.
        """            
        self.update_buffer()   
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)

        if (np.mod(self.enctime,4)==0 or ENC==0 or 1):

            if (1):

                gl.glBindTexture(gl.GL_TEXTURE_2D, self.idtexgl)
                gl.glEnable(gl.GL_TEXTURE_2D)
                gl.glBegin(gl.GL_QUADS)
                gl.glTexCoord2f(0.0, 0.0)
                gl.glVertex2f(0, 0); 
                gl.glTexCoord2f(1.0, 0.0)
                gl.glVertex2f( 1.0, 0); 
                gl.glTexCoord2f(1.0, 1.0)
                gl.glVertex2f( 1.0, 1.0); 
                gl.glTexCoord2f(0.0, 1.0)
                gl.glVertex2f(0, 1.0);
                gl.glEnd()

            else:
                gl.glColor4d(0.5,0.7,0.8,0.04)
                gl.glEnable(gl.GL_BLEND)
                gl.glBlendEquationSeparate( gl.GL_FUNC_ADD,  gl.GL_FUNC_ADD);
                gl.glBlendFuncSeparate(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_ONE,    gl.GL_ONE, gl.GL_ZERO);
                # bind the VBO
                self.glbuf.bind()
                # tell OpenGL that the VBO contains an array of vertices
                gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
                # these vertices contain 2 simple precision coordinates
                gl.glVertexPointer(2, gl.GL_FLOAT, 0, self.glbuf)
                # draw "count" points from the VBO
                gl.glDrawArrays(gl.GL_POINTS, 0, self.count)

        self.update()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号