From ebfd73503bc386e75d2debf2fc8858e1231e0ddf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 27 Nov 2009 22:33:19 +0100 Subject: Resize funktioniert jetzt unter Linux --- main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 87f5060..76838a2 100644 --- a/main.cpp +++ b/main.cpp @@ -41,13 +41,14 @@ void resize(int width, int height) height=1; } - glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(50.0f,(GLfloat)width/(GLfloat)height, 0.1, 1000); + gluPerspective(50.0f, (GLfloat)width/(GLfloat)height, 0.1, 1000); glMatrixMode(GL_MODELVIEW); + + glViewport(0, 0, width, height); } @@ -284,7 +285,7 @@ bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, bool *mul XSetWindowAttributes swa; swa.colormap = cmap; swa.border_pixel = 0; - swa.event_mask = /*PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask*/0; + swa.event_mask = StructureNotifyMask/* | PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask*/; *wnd = XCreateWindow(disp, RootWindow(disp, vi->screen), 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel|CWColormap|CWEventMask, &swa); @@ -353,10 +354,13 @@ int main() { XEvent event; XNextEvent(disp, &event); switch(event.type) { + case ConfigureNotify: + resize(event.xconfigure.width, event.xconfigure.height); + break; + case ClientMessage: if(static_cast(event.xclient.data.l[0]) == windele) running = false; - break; } } -- cgit v1.2.3