   GL_EXT_Framebuffer_Object weird scissor test behaviour
  Hello. Maybe someone who has worked with this extension more extensively may point me to a solution. Here are two of my concerns:1. When rendering to a texture + depth buffer with the GL_EXT_Framebuffer_Object extension, I need to clear just the current viewport, which is a fraction of the whole renderbuffer size(part of an imposter table for trees). The obvious solution would be, as specified in the OpenGL documentation, to use scissor test with glClear. The problem is that any reference to scissor test(even calling just glDisable) makes my method not render anything at all into the FB. Does anyone know how to fix this?2. I tried to include a stencil renderbuffer, first with my prefered format(1 bit), then like in the example from the extension docs(simply GL_STENCIL_INDEX). But then I get the GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT status code, and my framebuffer does not get activated at all. Any hints on this? I hoped that a stencil buffer would make the scissor test work properly, but if you know it doesn't, please reply.//initialisation code:ext->glGenFramebuffersEXT(1,&frameBuffer);ext->glGenRenderbuffersEXT(1,&stencilBuffer);ext->glGenRenderbuffersEXT(1,&depthBuffer);ext->glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,depthBuffer);ext->glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24,tw,th);ext->glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,stencilBuffer);ext->glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX,tw,th);ext->glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,0);//activation code: gets called when I want to write to texture//unbind the texture before drawing to itglBindTexture(GL_TEXTURE_2D,0);ext->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,frameBuffer);//switch opengl operation to bufferext->glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,0);ext->glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, depthBuffer);ext->glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_STENCIL_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, stencilBuffer);ext->glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, imposterTex, 0);I'll keep trying in the meantime.Thanks[Edit]: the quick workaround with drawing rectangles to clear the viewport is not quite what I'd hoped in respect to performance. Also, the FBO worked very well when I tried it without the stencil attachment.[Edited by - Devildog on June 22, 2006 10:20:59 AM]
  currently stencil attachements don't work, I belive on all hardware, because current GPU arch doesn't allow for a seperate stencil and depth buffer, instead they have a setup where the depth and stencil buffers are packed together as [24bit depth, 8bit stencil] (which is why you should clear depth adn stencil at the same time on your framebuffer).Can you post your code WITH the scissor test stuff added please?I suspect, if the spec doesn't say anything about this behaviour, then its a driver bug, but don't quote me on that... ;  I update each part of the framebuffer when needed. So the binding is done once, like in the original post(minus stencil part), and the following happens n times, for each update:The code with scissor test looks something like this://update part of big texture, for one tree:glViewport(vx,vy,size,size);camera.Update(); //camera looks to the tree at correct FOV to take snapshot//clear buffer:glScissor(0,0,size,size);glEnable(GL_SCISSOR_TEST);glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);glDisable(GL_SCISSOR_TEST);DrawObject();//end code.Even if I leave just the glDisable(GL_SCISSOR_TEST) part, it still clears all the framebuffer and draws nothing in it(presumably because some test fails internally.. maybe). So even if the scissor values are wrong, there is something disfunctional here...Thanks for the info on the stencil functionality. I don't need stencil, just scissor, they should work separately, right?;  I've just installed the latest drivers and the behavior is the same. I'm just hacking around this with a lot of rectangles clearing the color bit.   