summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-11-27 22:33:19 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-11-27 22:33:19 +0100
commitebfd73503bc386e75d2debf2fc8858e1231e0ddf (patch)
treea9fa1b6739ac5e3af23e0af002a54dd4f6a51e14 /main.cpp
parent873bf9be915d5c46b6bbdbcd788fb94b646ee6fb (diff)
downloadc3d-ebfd73503bc386e75d2debf2fc8858e1231e0ddf.tar
c3d-ebfd73503bc386e75d2debf2fc8858e1231e0ddf.zip
Resize funktioniert jetzt unter Linux
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp12
1 files 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<Atom>(event.xclient.data.l[0]) == windele)
running = false;
- break;
}
}