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/pugl_x11.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'pugl/pugl_x11.c') diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 755dd87..d80b71b 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -174,22 +173,13 @@ puglReshape(PuglView* view, int width, int height) glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx); if (view->reshapeFunc) { - // User provided a reshape function, defer to that view->reshapeFunc(view, width, height); } else { - // No custom reshape function, do something reasonable - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45.0f, width/(float)height, 1.0f, 10.0f); - glViewport(0, 0, width, height); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + puglDefaultReshape(view, width, height); } - view->width = width; - view->height = height; - view->redisplay = true; + view->width = width; + view->height = height; } void @@ -310,11 +300,11 @@ puglProcessEvents(PuglView* view) if (view->mouseFunc && (event.xbutton.button < 4 || event.xbutton.button > 7)) { view->mouseFunc(view, - event.xbutton.button, event.type == ButtonPress, - event.xbutton.x, event.xbutton.y); + event.xbutton.button, event.type == ButtonPress, + event.xbutton.x, event.xbutton.y); } break; - case KeyPress: + case KeyPress: { setModifiers(view, event.xkey.state); KeySym sym; char str[5]; @@ -329,7 +319,7 @@ puglProcessEvents(PuglView* view) } else if (view->specialFunc) { view->specialFunc(view, true, key); } - break; + } break; case KeyRelease: { setModifiers(view, event.xkey.state); bool repeated = false; @@ -355,7 +345,7 @@ puglProcessEvents(PuglView* view) view->specialFunc(view, false, special); } } - } + } break; case ClientMessage: if (!strcmp(XGetAtomName(view->impl->display, event.xclient.message_type), -- cgit v1.2.3