diff options
author | David Robillard <d@drobilla.net> | 2012-05-02 20:49:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-02 20:49:13 +0000 |
commit | f027f3810baaa93bd4b8273b774421053e8e1cac (patch) | |
tree | 8fad8d4ffe6c1e37962b45ce66333c8d9eae5c94 /pugl_test.c | |
parent | 56cc27fe0eec999f5e01e9b40f5bd16929713eed (diff) | |
download | pugl-f027f3810baaa93bd4b8273b774421053e8e1cac.tar.gz pugl-f027f3810baaa93bd4b8273b774421053e8e1cac.tar.bz2 pugl-f027f3810baaa93bd4b8273b774421053e8e1cac.zip |
Remove GLU dependency.
Fix compilation errors on X11.
Make default resize function set up a 2D view.
Set appropriate reshape callback in pugl_test.
Diffstat (limited to 'pugl_test.c')
-rw-r--r-- | pugl_test.c | 20 |
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) { |