summaryrefslogtreecommitdiff
path: root/progs/util/idproj.c
diff options
context:
space:
mode:
authorjtg <jtg>1999-08-19 00:55:39 +0000
committerjtg <jtg>1999-08-19 00:55:39 +0000
commitafb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1c (patch)
tree59d65b4da12fb5379224cf5f6b808fde91523c7f /progs/util/idproj.c
parentf2544d4920ce168bec9cd94d774b7ea5103a3d74 (diff)
Initial revision
Diffstat (limited to 'progs/util/idproj.c')
-rw-r--r--progs/util/idproj.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/progs/util/idproj.c b/progs/util/idproj.c
new file mode 100644
index 0000000000..d5ee3409f3
--- /dev/null
+++ b/progs/util/idproj.c
@@ -0,0 +1,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.
+ */
+
+
+
+
+
+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();
+}
+