Jump to content
  • Advertisement
Sign in to follow this  
slynk

OpenGL Obtaining Screen Boundaries

This topic is 2858 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

So I'm helping code a library for the PS3 but I don't have any OpenGL ES experience. I made a sprite class but I obviously didn't understand the screen coordinate system. I wrote the code to convert the coordinate system into an easier to use one but for it to work, I need to keep track of how OpenGL sees things.

Is there a way for me to tell what the screen width is from OpenGL's perspective? If I can, it's a matter of plugging it into the formula and I'm good to go. Ps3 uses OpenGL ES so keep that in mind please. ^^

Share this post


Link to post
Share on other sites
Advertisement
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);


EDIT: Actually.. that doesn't seem to be in the documentation for OpenGL ES.. so it might not work. There's GL_MAX_VIEWPORT_DIMS but not sure what it will return. Do you ever set the view-port in your code?
If so, just store those values. If not, you might need a platform dependent way.

You can also check the OpenGL ES reference pages and see if you find something.
2.0: http://www.khronos.org/opengles/sdk/docs/man/
1.1: http://www.khronos.org/opengles/sdk/1.1/docs/man/
1.0: http://www.khronos.org/opengles/documentation/opengles1_0/html/.

EDIT2: A quick Google found this which seems to use something called a GLView and CGRect rect = view.bounds to obtain the view rectangle. I've never tried PS3 programming, but perhaps that means something to you? =)

Later EDIT: Actually it might work after all, GL_VIEWPORT seems to be available in the documentation for both 1.1 and 2.0, but not in 1.0.

[Edited by - Erik Rufelt on October 19, 2010 3:00:05 PM]

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!