Hi Derakon,

On Wed, Dec 1, 2010 at 3:44 PM, Derakon <derakon@gmail.com> wrote:
On Tue, Nov 30, 2010 at 12:50 PM, Derakon <derakon@gmail.com> 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
megaTileFramebuffer) # error occurs here
                   GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
                   self.texture, 0)

           glViewport(0, 0, megaTilePixelSize, megaTilePixelSize)
           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)

           for tile in newTiles:
               print glGetString(GL_VERSION)
           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

These are just a couple of things you might want to check (if you haven't already). From the top of my head, I would expect all of these to trigger Invalid Operation errors:

1) Since "megaTileFramebuffer" is a global variable, are you sure you are calling glGenFramebuffers with a valid OpenGL context? If you make the assignment at file scope, this is probably running before the context is created. This could trigger an Invalid Operation. Also, try printing "megaTileFramebuffer" to the console and make sure it's not 0.

2) Has the texture identified by "self.texture" already been created (glGenTextures) when attempting to bind the FBO?

3) Have you tried using GL_FRAMEBUFFER as the first parameter for glFrameBufferTexture2D?

4) This might sound silly, but are you certain this is not being executed "inside" a glBegin?

Good luck!


Alejandro Segovia Azapian
Director, Algorithmia: Visualization & Acceleration