Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- #include <Windows.h>
- #include <gl/GL.h>
- #include <gl/GLU.h>
- #include <iostream>
- #ifdef main
- #undef main
- #endif
- #pragma comment (lib, "sdl.lib")
- #pragma comment (lib, "opengl32.lib")
- #pragma comment (lib, "glu32.lib")
- int main () {
- SDL_Init (SDL_INIT_EVERYTHING);
- SDL_SetVideoMode (800, 600, 32, SDL_OPENGL);
- glViewport (0, 0, 800, 600);
- glClearColor (1.f, 1.f, 1.f, 1.f);
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- //glOrtho (0.f, 800.f, 600.f, 0.f, 0.f, 1.f);
- gluPerspective (45.f, 800.f/600.f, 0.1f, 1000.f);
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
- glDisable (GL_DEPTH_TEST);
- bool quit = false;
- while (!quit) {
- SDL_Event ev;
- SDL_PumpEvents ();
- while (SDL_PollEvent (&ev)) {
- if (ev.type == SDL_QUIT)
- quit = true;
- }
- Sleep (16);
- glClear (GL_COLOR_BUFFER_BIT);
- glRotatef (0.5f, 0.f, 0.f, 1.f);
- glBegin (GL_QUADS);
- glColor3f (1.f, 0.f, 0.f);
- glVertex3f (-1.f, 1.f, -10.f);
- glVertex3f ( 1.f, 1.f, -10.f);
- glVertex3f ( 1.f, -1.f, -10.f);
- glVertex3f (-1.f, -1.f, -10.f);
- glEnd ();
- SDL_GL_SwapBuffers ();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement