Re: [PyOpenGL-Users] bug in glDrawBuffers?
Brought to you by:
mcfletch
From: Gijs <in...@bs...> - 2009-02-18 09:39:57
|
Mike C. Fletcher wrote: > Gijs wrote: >> Hello List, >> >> I am trying to use glDrawBuffers to render to multiple textures using >> shaders. However, I'm running into a problem (otherwise I wouldn't be >> posting here ofcourse :) ). When I call glDrawBuffers with *any* >> buffer-type, it fails with the following error: >> > Can you add this to tests/test.py and then alter it with fragments of > your usage/code until it shows your error: > > def test_glDrawBuffers_list_valid( self ): > """Test that glDrawBuffers with list argument where value is set""" > fbo = glGenFramebuffersEXT(1) > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo) > try: > img1,img2 = glGenTextures(2) > for img in img1,img2: > glBindTexture( GL_TEXTURE_2D, img ) > glTexImage2D( > GL_TEXTURE_2D, 0, GL_RGB8, > 300, 300, 0, GL_RGB, > GL_INT, > None # no data transferred > ) > glFramebufferTexture2DEXT( > GL_FRAMEBUFFER_EXT, > GL_COLOR_ATTACHMENT0_EXT, > GL_TEXTURE_2D, img1, 0 > ) > glFramebufferTexture2DEXT( > GL_FRAMEBUFFER_EXT, > GL_COLOR_ATTACHMENT1_EXT, > GL_TEXTURE_2D, img2, 0 > ) > drawingBuffers = [ > GL_COLOR_ATTACHMENT0_EXT, > GL_COLOR_ATTACHMENT1_EXT, > ] > glDrawBuffers(2, drawingBuffers ) > finally: > glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ) > > then send back the error-ing version so that I can look into what's > going wrong without having to guess too much? >> Hope someone knows what's going on under the hood. >> > I *think* this should be working, I haven't had time to sit down and do > shadow-casting myself, so I don't have any real-world code to test it. > The code is pretty much just passing your values off to the C code, so > there's not a lot under the hood that's PyOpenGL specific. > > HTH, > Mike > Hello Mike, Thanks for your reply. I needed to cast some arguments (img, fbo) to int and after that the code ran just fine, but the error remains (pasted below). Also, I made a Python-C module to see whether the same error would occur there. But with the exact same code in C, I could call glDrawBuffers to draw to multiple buffers without any problems. So even though the Python code should not really do much with the call, it does something to mess it up. Traceback (most recent call last): File "./multiple-output.py", line 201, in <module> test_glDrawBuffers_list_valid() File "./multiple-output.py", line 197, in test_glDrawBuffers_list_valid glDrawBuffers(2, drawingBuffers) File "/Library/Python/2.5/site-packages/OpenGL/platform/baseplatform.py", line 275, in __call__ return self( *args, **named ) File "/Library/Python/2.5/site-packages/OpenGL/error.py", line 194, in glCheckError baseOperation = baseOperation, OpenGL.error.GLError: GLError( err = 1280, description = 'invalid enumerant', baseOperation = glDrawBuffers, cArguments = ( 2, [ GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT ], ) ) Regards, Gijs |