comp sci balla
comp sci balla

Reputation: 823

Drawing a rectangle that fits the screen

If a quad's coordinates are defined as:

(-1,-1,0)  (-1,1,0)  
( 1,-1,0)  ( 1,1,0)

and use:

GLU.gluPerspective(gl, 45.0f, aspectRatio, 0.1f, 100.0f);      
GLU.gluLookAt(gl, 0, 0, 1, 0, 0, 0, 0, 1, 0);

what scale values or glLookAt values or whatever values would be needed to make the square appear to precisely cover a rectangular viewing area (no more, no less)? Thanks!!

Upvotes: 0

Views: 493

Answers (1)

Tim
Tim

Reputation: 35943

Does it have to be perspective projection? It would be a lot easier to drop gluPerspective and gluLookAt and just use an orthographic matrix:

I'd replace both lines with just

glOrtho(-1,1,-1,1,-1,1);

Upvotes: 1

Related Questions