From 7bd5f9dd60204fa7bfc9a1b5d6fa982be0bfe3ec Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Tue, 8 Sep 2015 18:22:44 -0400 Subject: Added windowClass files --- src/windowClass.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/windowClass.cpp (limited to 'src/windowClass.cpp') diff --git a/src/windowClass.cpp b/src/windowClass.cpp new file mode 100644 index 0000000..942ba86 --- /dev/null +++ b/src/windowClass.cpp @@ -0,0 +1,38 @@ +#include + +void Window::setupRender(){ + glClearColor(0,0,0,0); //set the background color + +} + +void Window::render(){ + + glMatrixMode(GL_PROJECTION); //set the matrix mode as projection so we can set the ortho size and the camera settings later on + glPushMatrix(); //load the settings into the matrix + glLoadIdentity(); //save the matrix + + glOrtho(0,SCREEN_WIDTH, 0,SCREEN_HEIGHT, -1,1); //set the the size of the screen + + glMatrixMode(GL_MODELVIEW); //set the matrix to modelview so we can draw objects + glPushMatrix(); //load + glLoadIdentity(); //save + + glPushMatrix(); //start a new matrix + glClear(GL_COLOR_BUFFER_BIT); //clear the screen + + /************************** + **** RENDER STUFF HERE **** + **************************/ + glColor3f(1.0f, 0.0f, 0.0f); + glRectf(0,0, 50,50); //draw a test rectangle + glColor3f(0.0f, 1.0f, 0.0f); + glRectf(50,0, 100,50); + glColor3f(0.0f, 0.0f, 1.0f); + glRectf(100,0,150,50); + /************************** + **** CLOSE THE LOOP **** + **************************/ + + glPopMatrix(); //see ya' matrix + SDL_GL_SwapWindow(window); //give the render to SDL to display it +} \ No newline at end of file -- cgit v1.2.3