View Full Version : How can I draw a quad that covers the whole screen
07-12-2010, 01:45 PM
How can that be done? I wont to implement deferred shading and to do that I need to render a quad that are covered with a texture. How can I make the quad cover the whole screen even when I move the camera around?
07-12-2010, 02:56 PM
Create the corner points for the quad using the same parameters you pass to glViewport. Then render the quad using an orthographic projection matrix (e.g. call glOrtho with the same 2D extent passed to glViewport) and an identity model matrix.
If you google, there should be plenty of sample code floating around.
07-14-2010, 09:19 AM
Just render the quad from (-1,-1) to (1,1) and set your modelview and projection matrices to the identity. Turn off depth testing. Your quad then goes into and covers the screen in homogeneous coords. By setting glViewport you can make it cover the whole screen or even (for debug) cover some part of the screen...
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.