Thread: [PyOpenGL-Users] Problem attaching Texture to FBO on intel GMA 45000MHD (error when calling glFrame
Brought to you by:
mcfletch
From: Thomas H. <tho...@gm...> - 2010-02-04 18:06:53
|
Hi everyone, I using PyOpenGL 3.0.1b2 on Windows 7 on a Dell XT 2 tablet PC (http://www.dell.com/tablet). The tablet has a intel GMA 4500MHD graphics chip with the newest drivers from intel installed. I'm having problems creating a Framebuffer object using pyOpenGL. The following code runs fine on every machine I have access to except for this one. I know the graphics chip has FBO support, and have successfully compiled and run various C programs using FBO's. The problem occurs when I call glFramebufferTexture2DEXT, to attach my texture to the FBO. The program crashes and prints a traceback with GL error code 1286, which I believe is INVALID_FRAMEBUFFER_OPERATION_EXT. If anyone knows what I am doing wrong, has a workaround, or even just a suggestion of identifying the problem better, I would be very thankful. I'm posting a code snippet and the output it produces. I know teh code isnt complete and nothing is actually done with the fbo etc. but its enough to crash the program, and demonstrates the first problem I encounter on this machine. The code: ======================================================================= import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GL.EXT.framebuffer_object import * def draw (): glClearColor(0.0,0.0,0.0,0.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) #draw stuff here pygame.display.flip() pygame.init() pygame.display.set_mode((512,512),OPENGL | DOUBLEBUF) #setup a texture tex = glGenTextures(1); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, None); glBindTexture(GL_TEXTURE_2D, 0); #setup teh fbo fbo = glGenFramebuffersEXT(1) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo) glBindTexture(GL_TEXTURE_2D, tex) #this call produces an error! glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, tex, 0) while 1: event=pygame.event.poll () if event.type is QUIT: sys.exit(0) draw() Here is the output: =================================================================== Traceback (most recent call last): File "test.py", line 29, in <module> glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, tex, 0) File "C:\Python26\lib\site-packages\pyopengl-3.0.1b2-py2.6-win32.egg\OpenGL\platform\baseplatform.py", line 335, in __call__ return self( *args, **named ) File "C:\Python26\lib\site-packages\pyopengl-3.0.1b2-py2.6-win32.egg\OpenGL\error.py", line 208, in glCheckError baseOperation = baseOperation, OpenGL.error.GLError: GLError( err = 1286, baseOperation = glFramebufferTexture2DEXT, cArguments = ( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, 1L, 0, ) ) Thanks alot!! -- Thomas Hansen |
From: Thomas H. <tho...@gm...> - 2010-02-04 21:35:58
|
I figured out a workaround. If I disable OpenGL.ERROR_CHECK, everything works just fine. If I get the error code after calling glFramebufferTexture2DEXT, it does not return a bad code, but instead the expected GL_FRAMEBUFFER_COMPLETE_EXT code. So I'm guessing there is a bug in the error checking somewhere? It's funky behavior though, and only happens on this laptop (but I've tried with all the 3.0 > pyOpenGL version). Another odd thing is that bool(glGenFrameBuffersEXT) returns false, although the function clearly exists. So still not sure exactly why this is happening, but at least it works with minor work around (would be nice for debugging if I could get the auto ERROR_CHECK to work at teh same time though) -- Thomas On Thu, Feb 4, 2010 at 12:06 PM, Thomas Hansen <tho...@gm...> wrote: > Hi everyone, > > I using PyOpenGL 3.0.1b2 on Windows 7 on a Dell XT 2 tablet PC > (http://www.dell.com/tablet). The tablet has a intel GMA 4500MHD > graphics chip with the newest drivers from intel installed. I'm having > problems creating a Framebuffer object using pyOpenGL. The following > code runs fine on every machine I have access to except for this one. > I know the graphics chip has FBO support, and have successfully > compiled and run various C programs using FBO's. > > The problem occurs when I call glFramebufferTexture2DEXT, to attach my > texture to the FBO. The program crashes and prints a traceback with > GL error code 1286, which I believe is > INVALID_FRAMEBUFFER_OPERATION_EXT. > > If anyone knows what I am doing wrong, has a workaround, or even just > a suggestion of identifying the problem better, I would be very > thankful. > > I'm posting a code snippet and the output it produces. I know teh > code isnt complete and nothing is actually done with the fbo etc. but > its enough to crash the program, and demonstrates the first problem I > encounter on this machine. > > The code: > ======================================================================= > import pygame > from pygame.locals import * > from OpenGL.GL import * > from OpenGL.GL.EXT.framebuffer_object import * > > def draw (): > glClearColor(0.0,0.0,0.0,0.0) > glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) > #draw stuff here > pygame.display.flip() > > pygame.init() > pygame.display.set_mode((512,512),OPENGL | DOUBLEBUF) > > #setup a texture > tex = glGenTextures(1); > glBindTexture(GL_TEXTURE_2D, tex); > glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, > GL_UNSIGNED_BYTE, None); > glBindTexture(GL_TEXTURE_2D, 0); > > #setup teh fbo > fbo = glGenFramebuffersEXT(1) > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo) > glBindTexture(GL_TEXTURE_2D, tex) > > #this call produces an error! > glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, > GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, tex, 0) > > while 1: > event=pygame.event.poll () > if event.type is QUIT: > sys.exit(0) > draw() > > > Here is the output: > =================================================================== > Traceback (most recent call last): > File "test.py", line 29, in <module> > glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, > GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, tex, 0) > File "C:\Python26\lib\site-packages\pyopengl-3.0.1b2-py2.6-win32.egg\OpenGL\platform\baseplatform.py", > line 335, in __call__ > return self( *args, **named ) > File "C:\Python26\lib\site-packages\pyopengl-3.0.1b2-py2.6-win32.egg\OpenGL\error.py", > line 208, in glCheckError > baseOperation = baseOperation, > OpenGL.error.GLError: GLError( > err = 1286, > baseOperation = glFramebufferTexture2DEXT, > cArguments = ( > GL_FRAMEBUFFER_EXT, > GL_COLOR_ATTACHMENT0_EXT, > GL_TEXTURE_2D, > 1L, > 0, > ) > ) > > > Thanks alot!! > > -- > Thomas Hansen > |
From: Gijs <in...@bs...> - 2010-02-04 21:51:28
|
Hello Thomas, I don't really have a solution for you, but you can use the following code to check what PyOpenGL actually does with your calls/data: import logging import OpenGL logging.basicConfig( level = logging.DEBUG ) OpenGL.FULL_LOGGING = True You might be able to figure out why it gives the error using the output. Regards, Gijs On 4-2-2010 22:35, Thomas Hansen wrote: > I figured out a workaround. If I disable OpenGL.ERROR_CHECK, > everything works just fine. If I get the error code after calling > glFramebufferTexture2DEXT, it does not return a bad code, but instead > the expected GL_FRAMEBUFFER_COMPLETE_EXT code. So I'm guessing there > is a bug in the error checking somewhere? > > It's funky behavior though, and only happens on this laptop (but I've > tried with all the 3.0> pyOpenGL version). Another odd thing is that > bool(glGenFrameBuffersEXT) returns false, although the function > clearly exists. > > So still not sure exactly why this is happening, but at least it works > with minor work around (would be nice for debugging if I could get the > auto ERROR_CHECK to work at teh same time though) > > -- > Thomas > > > |
From: Ian M. <geo...@gm...> - 2010-02-04 23:09:03
|
They problem may be that you need a renderbuffer. framebuffer = glGenFramebuffersEXT(1) renderbuffer = glGenRenderbuffersEXT(1) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebuffer) glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,renderbuffer) glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT, size[0],size[1]) glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,renderbuffer) glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,attachment,GL_TEXTURE_2D,texture,0) glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,0) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0) |