Re: [PyOpenGL-Users] Odd framebuffer error
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2010-12-02 13:16:23
|
On 10-11-30 02:40 PM, Derakon wrote: ... > I made a test program that works fine (on my OSX laptop), but I'm > running into an error when I try to adapt the code to the main program > (on a considerably more powerful Windows 7 box). Each small texture is > contained in a Tile class instance, and a single Tile can be placed > and oriented arbitrarily. Meanwhile, the entire working area is tiled > with MegaTile instances; Tiles are pre-rendered onto MegaTiles using > framebuffers as needed. However, I'm getting a 1286 error when I call > glEnd() after rendering a Tile. From what I can tell this means I > didn't set up the framebuffer properly, but it looks fine to me. I > must be missing something. > Win32 has some funkiness relating to FBOs, from OpenGLContext's shadow tutorial: fbo = glGenFramebuffers(1) '''It has to be bound to configure it.''' glBindFramebuffer(GL_FRAMEBUFFER, fbo ) '''The texture itself is the same as the last tutorial.''' texture = glGenTextures( 1 ) glBindTexture( GL_TEXTURE_2D, texture ) glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0, GL_DEPTH_COMPONENT, GL_FLOAT, None ) '''We attach the texture to the FBO's depth attachment point. There is also a combined depth-stencil attachment point when certain extensions are available. We don't actually need a stencil buffer just now, so we can ignore that. The final argument is the "mip-map-level" of the texture, which currently always must be 0. ''' glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texture, 0 #mip-map level... ) if sys.platform == 'win32': color = glGenRenderbuffers(1) glBindRenderbuffer( GL_RENDERBUFFER, color ) glRenderbufferStorage( GL_RENDERBUFFER, GL_RGBA, shadowMapSize, shadowMapSize, ) glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color ) glBindRenderbuffer( GL_RENDERBUFFER, 0 ) holder = mode.cache.holder( light,(fbo,texture),key=key ) don't have time to track down why that was done this morning, but I'd suspect that's likely where you're getting tripped up. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |