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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#include "sdl.h"
#include "GL_Functions.h"
#include <time.h>
int SDL_main(int argc, char* argv[])
{
//Used in the main loop
bool Done = false;
//Used to store SDL events
SDL_Event event;
//Lets open the window and initialise opengl
InitGL(1024,768);
float colorOffset = 0;
//int face = LoadTexture("block.png");
//GetTimeElapsed();
unsigned int colour = 0;
while(!Done)
{
//Clear the screen
glClear(GL_COLOR_BUFFER_BIT);
//colorOffset += GetTimeElapsed();
glTranslatef (0.0,0.0,0.0);
glRotatef (-0.001,0.0 ,0.0 ,-10.0);
//glBindTexture(GL_TEXTURE_2D, face);
glBegin(GL_QUADS);
//glTexCoord2f(0,0);
glColor3f(1,0,0);
glVertex2i(328,164);
//glTexCoord2f(1,0);
glColor3f(0,1,0);
glVertex2i(584,164);
//glTexCoord2f(1,1);
glColor3f(0,0,1);
glVertex2i(584,420);
//glTexCoord2f(0,1);
glColor3f(0,0,0);
glVertex2i(328,420);
glEnd();
//Present that freshly drawn scene to the screen
SDL_GL_SwapBuffers();
//While we have events (keyboard, mouse, window etc)
while( SDL_PollEvent(&event) )
{
// if the window X was clicked on, ALT_F4 etc
if ( event.type == SDL_QUIT )
Done = true;
//If we have had a key press
if ( event.type == SDL_KEYDOWN )
{
//And the key was escape
if ( event.key.keysym.sym == SDLK_ESCAPE )
Done = true;
}
}
}
SDL_Quit();
return 0;
}
|