summaryrefslogtreecommitdiffstats
path: root/sdl/pyramid.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdl/pyramid.c')
-rw-r--r--sdl/pyramid.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sdl/pyramid.c b/sdl/pyramid.c
index e08b426..265ffcd 100644
--- a/sdl/pyramid.c
+++ b/sdl/pyramid.c
@@ -1,6 +1,6 @@
/* pyramid.c
*
- * @2010 Kamil Kaminski
+ * @2011 Kamil Kaminski
*
* notes: since lighting is enabled, we need to specify normals for
* each polygon face so the OpenGL can calculate e.g. how light reflects
@@ -63,7 +63,7 @@ static void resize(int w, int h)
glLoadIdentity();
/* this needs to be ran again, glut does it for you I suppose */
- SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE);
+ SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
}
static void setup_opengl(void)
@@ -302,8 +302,14 @@ int main(int argc, char **argv)
atexit(SDL_Quit);
SDL_WM_SetCaption("Textured Pyramid", NULL);
- if ((screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL | SDL_GL_DOUBLEBUFFER
- | SDL_RESIZABLE)) == NULL)
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+
+ if ((screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL | SDL_RESIZABLE)) == NULL)
{
fprintf(stderr, "unable to set video mode: %s\n", SDL_GetError());
exit(-1);