aboutsummaryrefslogtreecommitdiffstats
path: root/pugl_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'pugl_test.c')
-rw-r--r--pugl_test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/pugl_test.c b/pugl_test.c
index 6eeed1a..8338d51 100644
--- a/pugl_test.c
+++ b/pugl_test.c
@@ -23,12 +23,31 @@
#include "pugl/pugl.h"
+// Argh!
+#ifdef __APPLE__
+# include <OpenGL/glu.h>
+#else
+# include <GL/glu.h>
+#endif
+
static int quit = 0;
static float xAngle = 0.0f;
static float yAngle = 0.0f;
static float dist = 10.0f;
static void
+onReshape(PuglView* view, int width, int height)
+{
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glViewport(0, 0, width, height);
+ gluPerspective(45.0f, width/(float)height, 1.0f, 10.0f);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+static void
onDisplay(PuglView* view)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -162,6 +181,7 @@ main(int argc, char** argv)
puglSetScrollFunc(view, onScroll);
puglSetSpecialFunc(view, onSpecial);
puglSetDisplayFunc(view, onDisplay);
+ puglSetReshapeFunc(view, onReshape);
puglSetCloseFunc(view, onClose);
while (!quit) {