PDA

View Full Version : problems with fbo and viewport size



lobbel
05-10-2010, 04:56 PM
hello,
I have a problem that I dont understand.
I've created a fbo and attached a texture to it.
I render to texture and for testing I draw a viewport
quad and then texture this quad. This works as long as
the texture is as large as the current viewport. I didnt
forget to store and restore the viewport while using the fbo.

For this code part, I the problem occurs described above.
But if I use the same fbo and draw just a simple cube inside
and the fbo-texture is different then the current viewport,
it works. But not for this code below. I cant understand why.
Any ideas ?


fbo.bind();
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0, 0, tex->getWidth(), tex->getHeight());
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glClear(GL_COLOR_BUFFER_BIT);
glslRaycastSimple.bind();
glslRaycastSimple.setSampler(string("entryPoints"), GL_TEXTURE_2D, tempImage->getId(), 0);
glslRaycastSimple.setSampler(string("exitPoints"), GL_TEXTURE_2D, exitPoints->getId(), 1);
glslRaycastSimple.setSampler(string("volume"), GL_TEXTURE_3D, volumeGL->getVolumeTex()->getId(), 2);
glslRaycastSimple.setUniform2f(string("screenReciproc"), 1.0f/float(canvas->getScreenWidth()), 1.0f/float(canvas->getScreenHeight()));
glslRaycastSimple.setUniform1f(string("stepWide"), 0.002f);
drawFace();
glslRaycastSimple.unbind();
glPopAttrib();
fbo.unbind();


regards,
lobbel