summaryrefslogtreecommitdiffstats
path: root/src/zoom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zoom.cpp')
-rw-r--r--src/zoom.cpp30
1 files changed, 7 insertions, 23 deletions
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 <unistd.h>
#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: