Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: FBO and viewport

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Dec 2007

    FBO and viewport

    I have an FBO with an attached 16bit RGBA color texture target. I bind the fbo, set the draw buffers, clear, and set the viewport equal to the dimensions of the render texture, activate the shader, draw the objects, all works.

    Using the same setup, I wanted to render into only the bottom left corner of the FBOs attached target. So I set the viewport to 0, 0, w/2, h/2.
    Now I either get nothing, or some sort of partial image only If I dont move the camera after startup.

    To do what Im asking, should it be as straight forward as simply changing the viewport, or is there something extra that Im missing when rendering to texture with FBO?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Viewports and framebuffer objects aren't directly associated. Viewport mapping is the final step of the transformation pipeline and maps values in normalized device coordinates to window- or screen-coordinates. This happens regardless of FBO usage. So there is no special catch in this case. However, if you change the viewport size, you should still see what you render - just mapped to a smaller area. Can you post some code?

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2007
    Thanks for the confirmation. I was a having a 'losing my mind' moment trying to figure out why something so simple didnt just work. Ive got it now, turns out the depth test was set to equal, which caused the image to only show for a moment at the start when the depths aligned perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts