Sign in to follow this  

Drawing Over the Whole Screen

Recommended Posts

levjs    466
Hi, Here's something that has been bothering me for a looong time. I am making a program that I want to be able to use in any screen dimension(1024x768, 1280x1024 etc.) The problem is, when I draw a square to cover the whole screen(say to put a background picture on), it may or may not cover the screen according to the screen resolution. For example, something that would cover the screen in 800x600 would not quite cover it in 1280x1024. What can I do to fix this? I'm drawing in projection mode, not orthographic. Thanks! Levi

Share this post

Link to post
Share on other sites
Kalidor    1087
Original post by levjs
...I'm drawing in projection mode, not orthographic...
I think you mean with a perspective projection matrix instead of an orthographic projection matrix.

Why not just use an orthographic projection when rendering the full-screen quad? Changing the projection matrix will be much faster than doing the math to calculate the screen extents. You can even just set the projection and modelview matrices to identity, then any vertices you pass to OpenGL will be in clip coordinates and if all of them have a w of 1.0 then this will be the same as normalized device coordinates. In this case the screen extents are simply (±1, ±1), so to draw a full-screen quad you simply render a quad from (-1,-1) to (1,1).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this