Jump to content
  • Advertisement
Sign in to follow this  
patrrr

OpenGL Window coordinates

This topic is 4362 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm trying to use the upper-left as origin for window coordinates in OpenGL, I've got a function that converts between those and it works great when setting up the viewport (glViewport). But when I try to render to a texture using a FBO, I get the lower-left corner even though my viewport is in the upper-left! Don't FBOs use the current viewport? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
FBO uses the viewport, yes, but the viewport's origin is always in the lower left corner. The best you can do is to convert from your upper-left system into OpenGL's lower-left system, but that only changes the parameters passed, it doesn't change the fact that the viewport is specified in a lower-left system.

Share this post


Link to post
Share on other sites
So the FBO covers (0, 0, viewport.width, viewport.height) and not (viewport.x, viewport.y, viewport.width, viewport.height)?
Ie, it doesn't care about the viewport's position?

Share this post


Link to post
Share on other sites
The coordinate system ranges from 0 in the lower/left corner, to height/width in the upper/right corner. This is the coordinate system in which you set the viewport. The viewport itself only defines the transformation from normalized device coordinates (the stage after perspective division) to device coordinates, nothing else.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!