summaryrefslogtreecommitdiff
path: root/tests/mesa/util/idproj.c
blob: 080755d9ddba6043b4bed00c4af62a2ee025ec7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* idproj.c */


/*
 * Setup an identity projection such that glVertex(x,y) maps to
 * window coordinate (x,y).
 *
 * Written by Brian Paul and in the public domain.
 */

#include <GL/gl.h>



void IdentityProjection( GLint x, GLint y, GLsizei width, GLsizei height )
{
   glViewport( x, y, width, height );
   glMatrixMode( GL_PROJECTION );
   glLoadIdentity();
   glOrtho( (GLdouble) x, (GLdouble) y,
            (GLdouble) width, (GLdouble) height,
            -1.0, 1.0 );
   glMatrixMode( GL_MODELVIEW );
   glLoadIdentity();
}