1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| #include "SDL.h"
#include "OpenGL/gl.h"
#include "OpenGL/glu.h"
int main (int argc, char **argv) {
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
if (SDL_SetVideoMode(640, 480, 32, SDL_OPENGL)==NULL)
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
SDL_WM_SetCaption("SDL GL Application", NULL);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective(70,(double)640/480,1,1000);
glEnable(GL_DEPTH_TEST);
bool c=true;
SDL_Event event;
while (c) {
while ( SDL_PollEvent(&event) ) {
if(event.type == SDL_KEYUP)
c=false;
else if( event.type == SDL_QUIT)
c=false;
}
}
SDL_Quit();
return 0;
} |
Partager