Reputation: 2471
I want to create a FrameBufferObject, but it fails and I don't know why.
Here is my code, it fails in the 4th line with following error-message:
ERROR:
Traceback (most recent call last):
File "/home/julius/workspace/Bachelor/Final/Exporter/FBOtest.py", line 154, in <module>
fbo.mainGameLoop()
File "/home/julius/workspace/Bachelor/Final/Exporter/FBOtest.py", line 142, in mainGameLoop
self.createFBO()
File "/home/julius/workspace/Bachelor/Final/Exporter/FBOtest.py", line 55, in createFBO
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, self.depthbuffer)
File "/usr/lib/pymodules/python2.7/OpenGL/platform/baseplatform.py", line 335, in __call__
return self( *args, **named )
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
CODE:
self.fbo = glGenFramebuffersEXT(1)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, self.fbo)
self.depthbuffer = glGenRenderbuffersEXT(GL_RENDERBUFFER_EXT)
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, self.depthbuffer)
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height)
glFramebufferReadBufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, self.depthbuffer)
self.texture = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, self.texture)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, None);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, self.texture, 0);
Upvotes: 0
Views: 90
Reputation: 1409
glGenRenderbuffersEXT
should get the number of buffers you wish to create (probably 1 in this case), and not GL_RENDERBUFFER_EXT as a parameter.
Upvotes: 1