Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <SDL.h>
  2. #include <GL/glew.h>
  3.  
  4. int main( int arc, char* args[] )
  5. {
  6. glewInit();
  7. SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  8. SDL_Init(SDL_INIT_VIDEO);
  9.  
  10. SDL_WM_SetCaption("Test Program", NULL);
  11.  
  12. SDL_Surface *screen = SDL_SetVideoMode(640,480,32,SDL_OPENGL);
  13.  
  14. glViewport(0,0,600,300);
  15. glClearColor( 0, 0, 0, 0 );
  16. glMatrixMode( GL_PROJECTION );
  17. glLoadIdentity();
  18. glMatrixMode(GL_MODELVIEW);
  19. //glOrtho( 0, 640, 480, 0, -1, 1 );
  20.  
  21. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  22. glLoadIdentity();
  23. glColor3f(1,0,0);
  24. glBegin(GL_POLYGON);
  25. glVertex2f(0.0, 0.0);
  26. glVertex2f(0.0, 3.0);
  27. glVertex2f(4.0, 3.0);
  28. glVertex2f(6.0, 1.5);
  29. glVertex2f(4.0, 0.0);
  30. glEnd();
  31. SDL_Delay(5000);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement