Re: [PyOpenGL-Users] Odd framebuffer error
Brought to you by:
mcfletch
From: Derakon <de...@gm...> - 2010-12-01 17:44:37
|
On Tue, Nov 30, 2010 at 12:50 PM, Derakon <de...@gm...> wrote: > > Ah yes, glGetString(GL_VERSION) reports "1.2 APPLE-1.5.48" on my > laptop but "3.2.0" on the Windows box. > > Guess it's time to try to track down where framebuffers are stored > when they aren't in OpenGL.GL.EXT. Thanks for the pointer. Okay, I've updated the Python OpenGL bindings on the Windows machine, and modified my code as follows: Changed imports: - from OpenGL.GL.EXT.framebuffer_object import * + from OpenGL.GL.framebufferobjects import * Main drawing code: # megaTileFramebuffer is a global singleton from glGenFramebuffers(1) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, megaTileFramebuffer) # error occurs here glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self.texture, 0) glViewport(0, 0, megaTilePixelSize, megaTilePixelSize) glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(-.375, viewer.m_w - .375, -.375, viewer.m_h - .375, 1, -1) glScalef(megaTileScaleFactor, megaTileScaleFactor, 1) glTranslatef(-self.pos[0], -self.pos[1], 0) glMatrixMode(GL_MODELVIEW) glEnable(GL_TEXTURE_2D) for tile in newTiles: print glGetString(GL_VERSION) tile.render(viewBox) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) I'm now getting a 1282 error (invalid operation) the first time glBindFramebuffer is called. I'm having a devil of a time finding examples for how this is supposed to work that are for OpenGL 3, but as far as I can tell from the "OpenGL API 3.2 API Quick Reference Card" PDF I downloaded, I'm doing this correctly. I've also tried using GL_FRAMEBUFFER instead of GL_DRAW_FRAMEBUFFER, and using self.texture instead of megaTileFramebuffer; either or both cause the same error at the same point. It seems like OpenGL just doesn't want me to call glBindFramebuffer at that point in execution. Is there some kind of preparation I'm supposed to have performed first? -Chris |