From 6d3965b35edf5f03cd065d42af31867acf1f4637 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 24 Dec 2009 02:47:35 +0100 Subject: Make shadow volumes visible --- src/zoom.cpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'src/zoom.cpp') diff --git a/src/zoom.cpp b/src/zoom.cpp index 8193d6a..8467816 100644 --- a/src/zoom.cpp +++ b/src/zoom.cpp @@ -35,20 +35,6 @@ #include #endif -void resize(int width, int height) { - if(height == 0) { - height = 1; - } - - - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(Zoom::MathUtil::perspective(50.0f, (float)width/(float)height, 0.1).array); - - glMatrixMode(GL_MODELVIEW); - - glViewport(0, 0, width, height); -} - #ifdef _WIN32 @@ -250,12 +236,13 @@ bool XIInit(Display *disp, int *opcode) { return true; } -bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, bool *multisample, int *xi_opcode, int *pointer) { +bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, int *xi_opcode, int *pointer) { static const int msAttributeList[] = {GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_X_RENDERABLE, True, GLX_DOUBLEBUFFER, True, GLX_DEPTH_SIZE, 1, + GLX_STENCIL_SIZE, 1, GLX_SAMPLE_BUFFERS, 1, GLX_SAMPLES, 4, None}; @@ -265,13 +252,13 @@ bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, bool *mul GLX_X_RENDERABLE, True, GLX_DOUBLEBUFFER, True, GLX_DEPTH_SIZE, 1, + GLX_STENCIL_SIZE, 1, None}; if(!XIInit(disp, xi_opcode)) return false; bool ok = false; - *multisample = true; int nElements; GLXFBConfig *fbConfig = glXChooseFBConfig(disp, DefaultScreen(disp), msAttributeList, &nElements); @@ -280,7 +267,6 @@ bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, bool *mul XFree(fbConfig); } - *multisample = false; fbConfig = glXChooseFBConfig(disp, DefaultScreen(disp), attributeList, &nElements); } @@ -362,17 +348,15 @@ int main() { Window wnd; GLXContext gc; - bool multisample; int xi_opcode; int pointer; - if(!GLXinit(disp, windele, &wnd, &gc, &multisample, &xi_opcode, &pointer)) + if(!GLXinit(disp, windele, &wnd, &gc, &xi_opcode, &pointer)) return 1; glewInit(); - resize(DEFAULT_WIDTH, DEFAULT_HEIGHT); - - Zoom::Game game(multisample); + Zoom::Game game; + game.resize(DEFAULT_WIDTH, DEFAULT_HEIGHT); GLint samples; glGetIntegerv(GL_SAMPLES, &samples); @@ -394,7 +378,7 @@ int main() { XNextEvent(disp, &event); switch(event.type) { case ConfigureNotify: - resize(event.xconfigure.width, event.xconfigure.height); + game.resize(event.xconfigure.width, event.xconfigure.height); break; case ClientMessage: -- cgit v1.2.3