Wednesday, October 20, 2010

Project 1 - Setting up OpenGL

Like in the previous update, this isn't much more than the steps required to set everything up for the upcoming coding work. The plan is to get the project, and the SDL, to be able to work with the OpenGL calls.

To get started, I'm getting some help from tutorials. One in particular that proved helpful is this one. Lots of great tutorials in that page. I haven't used the SDL before, so I'll be going back to it now and again. Since I have about as much experience with the Windows API, the decision to use SDL doesn't have much of a drawback.

First step is to tell the linker to use the opengl and glu libraries.

Next up, we include the header files in the project,
#include <gl/gl.h>
#include <gl/glu.h>

In order to tell SDL to use OpenGL, we add a couple of flags to the call to create a window,

SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL)

The parameters are almost the same, the changes help set up the details that OpenGL needs to operate, and keeps us from having to do it. Handy.

Well, OpenGL is a little involved, and it's been a while since I toyed with it, so the going is a little slow. Nevertheless, I have it up and running now. And, we're ahead of schedule!

So, coming up, drawing a sphere. Due on Sunday.

See ya.

 

No comments:

Post a Comment