From f027f3810baaa93bd4b8273b774421053e8e1cac Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 2 May 2012 20:49:13 +0000 Subject: Remove GLU dependency. Fix compilation errors on X11. Make default resize function set up a 2D view. Set appropriate reshape callback in pugl_test. --- pugl_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pugl_test.c') diff --git a/pugl_test.c b/pugl_test.c index 6eeed1a..8338d51 100644 --- a/pugl_test.c +++ b/pugl_test.c @@ -23,11 +23,30 @@ #include "pugl/pugl.h" +// Argh! +#ifdef __APPLE__ +# include +#else +# include +#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) { @@ -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) { -- cgit v1.2.3