diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-11-27 22:33:19 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-11-27 22:33:19 +0100 |
commit | ebfd73503bc386e75d2debf2fc8858e1231e0ddf (patch) | |
tree | a9fa1b6739ac5e3af23e0af002a54dd4f6a51e14 | |
parent | 873bf9be915d5c46b6bbdbcd788fb94b646ee6fb (diff) | |
download | c3d-ebfd73503bc386e75d2debf2fc8858e1231e0ddf.tar c3d-ebfd73503bc386e75d2debf2fc8858e1231e0ddf.zip |
Resize funktioniert jetzt unter Linux
-rw-r--r-- | main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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<Atom>(event.xclient.data.l[0]) == windele) running = false; - break; } } |