I am going through a render pass onto a FrameBufferObject such that I can use the result as a texture in the next rendering pass. Looking at tutorials, I need to call:
glBindFramebuffer(GL_TEXTURE2D, mFrameBufferObjectID);
glViewport(0, 0, mWidth, mHeight);
where mWidth and mHeight are the width and height of the frame buffer object. It seems without this glViewport call, nothing gets drawn correctly. What's strange is that upon starting the next frame, I need to call:
glViewport(0, 0, window_width, window_height);
so that I can go back to my previous width/height of the window; but calling it seems to only render my stuff at half of the original window size. So I physically only see a quarter of my screen gets stuff rendered onto (yes the entire scene is on it). I tried putting a break point and looking at the width and heigh values, they are the original values (1024, 640). Why is this happening? I tried doubling those and it correctly draws on my entire window.
I'm doing this on Mac via xcode and with glew.