Thursday, October 02, 2008

code::blocks - OpenGL - SDL

After my previous post I decided to play with SDL and try to setup code::blocks with both OpenGL and SDL.
I found it pretty simple (with code::blocks, so many things are easy, forget about gdb). Open your SDL project created previously, and set the link libraries as follow:
(In case you are lost: project->Build Options->Linker Settings

That's all, then you have to include the OpenGL headers or SDL headers:

If you want to include only OpenGL files, you can do the following:
#include <GL/gl.h>
#include <GL/glu.h>

SDL also includes a wrapper for OpenGL in the following file
#include <SDL_opengl.h>

Both should work with code generated by the Template. I have to stop here. If you need more information you can find several tutorials about SDL and OpenGL.

1 comment:

JH said...

thank you, i was getting a hard time trying to link correctly to sdl + opengl in CodeBlocks for linux. I success to did it in Windows but now I can port my project to linux too.