Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL.h>
- #include <GL/glew.h>
- int main( int arc, char* args[] )
- {
- glewInit();
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_Init(SDL_INIT_VIDEO);
- SDL_WM_SetCaption("Test Program", NULL);
- SDL_Surface *screen = SDL_SetVideoMode(640,480,32,SDL_OPENGL);
- glViewport(0,0,600,300);
- glClearColor( 0, 0, 0, 0 );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- //glOrtho( 0, 640, 480, 0, -1, 1 );
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glLoadIdentity();
- glColor3f(1,0,0);
- glBegin(GL_POLYGON);
- glVertex2f(0.0, 0.0);
- glVertex2f(0.0, 3.0);
- glVertex2f(4.0, 3.0);
- glVertex2f(6.0, 1.5);
- glVertex2f(4.0, 0.0);
- glEnd();
- SDL_Delay(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement