Frame Buffers wont work with pyglet.

Posted by Matthew Mitchell on Stack Overflow See other posts from Stack Overflow or by Matthew Mitchell
Published on 2010-03-22T23:29:26Z Indexed on 2010/03/22 23:31 UTC
Read the original article Hit count: 1107

Filed under:
|
|
|
|

I have this code:

def setup_framebuffer(surface):
#Create texture if not done already
if surface.texture is None:
    create_texture(surface)
#Render child to parent
if surface.frame_buffer is None:
    surface.frame_buffer =  glGenFramebuffersEXT(1)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface.frame_buffer)
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, surface.texture, 0)
glPushAttrib(GL_VIEWPORT_BIT)
glViewport(0,0,surface._scale[0],surface._scale[1])
glMatrixMode(GL_PROJECTION)
glLoadIdentity() #Load the projection matrix
gluOrtho2D(0,surface._scale[0],0,surface._scale[1])

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface.frame_buffer) for this despite the second parameter printing as 1 for a test I did, I get:

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface.frame_buffer)

I only got this after implementing pyglet. GLUT is too limited.

Thank you.

© Stack Overflow or respective owner

Related posts about python

Related posts about opengl