Question

I'm trying to work with framebuffer objects in PyOpenGL and have found some tutorials to teach myself. I'm working on a WinXP machine with Python 2.7.3 and I just installed the binary distributions of PyOpenGL 3.0.2 and PyOpenGL-accelerate 3.0.2. However, directly at the beginning I encounter a problem, in the sense that I get the error message that the fbo functions don't seem to exist. These are the steps to recreate my problem:

Importing the modules:

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GL.framebufferobjects import *

I now should have the framebuffer objects/functions available to me.

print glGenFramebuffers
print glBindFramebuffer

shows

<OpenGL.extensions.glGenFramebuffers object at 0x03172260>
<OpenGL.extensions.glBindFramebuffer object at 0x03172120>

However, if I try to call (make an instance) of this object, as specified in the tutorial, with:

fbo = glGenFramebuffers(1)
glBindFramebuffer(GL_FRAMEBUFFER, fbo )

I get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "latebind.pyx", line 31, in OpenGL_accelerate.latebind.LateBind.__call__ (src\latebind.c:645)
  File "C:\Python27\lib\site-packages\OpenGL\extensions.py", line 189, in finalise
    self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined alternate function (glGenFramebuffers, glGenFramebuffersEXT), check for bool(glGenFramebuffers) before calling

using

bool(glGenFramebuffers)

indeed returns False.

What am I doing wrong? Shouldn't all the required framebuffer libraries be installed with the binaries of PyOpenGL(-accelerate)?

Thanks in advance to anyone who can help me.

EDIT: I just found https://stackoverflow.com/questions/12953134/problems-with-frame-buffer-objects-fbos-in-pyopengl, with a similar problem, but no solution

Was it helpful?

Solution

Apparently the above code doesn't show this behavior and functions well if you run it from a file. I tried the above commands in the console and then

bool(glGenFramebuffers)

returns False

When run from file it returns True and everything functions normally. Additionally, you don't seem to need to include

from OpenGL.GL.framebufferobjects import *

in the newer versions of PyOpenGL (>= 3.0.2) as you also have access to Framebuffer objects without it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top