[VC++8] SDL and OpenGL

Started by
2 comments, last by Sirisian 17 years, 1 month ago
Okay, I've used SDL and OpenGL for about 3 years now. However, I never really figured out how to correctly set up OpenGL with SDL in Visual C++ 2005 express. I mean I got it to work with some really hacky methods that I can't figure out. It's been about 2 months since I took a break from C++ to mess around with other languages. I just got a physics project and I can't for the life of me figure out how to set up OpenGL with SDL correctly. Okay, I just reinstalled VC++ and deleted all my old SDL version 1.2.10 . I still have the platform SDK in my programs folder though. Is there any walk throughs to setting it up correctly and compiling a very simple

int main (int argc, char* argv[]) 
{
	return 0;
}






application. If anyone could show a tutorial or just quickly explain exactly what to install and do, I would be greatly appreciated. One thing I noticed: http://www.libsdl.org/download-1.2.php There's no VC++8 libraries. I think when I made my old games one of my on-line friends sent me the compiled libraries for VC++8. I need VC++8 libraries right? Or am I just mistaken. At the moment I'm confused so anyone's help would be greatly appreciated. I just don't want to have to end up programming this physics project in VB.NET or something... :( Time is of the essence. So if you think helping me on IRC is faster then: /server irc.freenode.net /join #gpwiki
Advertisement
Well, it's pretty simple really. First, use the VC6 file from the sdl website.

And setting up an opengl project is just as easy as a normal SDL project, just set the SDL_OPENGL flag and include SDL_opengl.h

Then don't forget to link with "SDL.lib SDLmain.lib OpenGL32.Lib"

This is just a simple initializations example.


#include "SDL.h"
#include "SDL_opengl.h"

int main( int arc, char* args[] )
{
SDL_Surface* pSurfScreen = 0;

if( SDL_Init( SDL_INIT_VIDEO|SDL_INIT_VIDEO )
(Apparently something went wrong with the last post)

Well, it's pretty simple really. First, use the VC6 file from the sdl website.

And setting up an opengl project is just as easy as a normal SDL project, just set the SDL_OPENGL flag and include SDL_opengl.h

Then don't forget to link with "SDL.lib SDLmain.lib OpenGL32.Lib"

This is just a simple initializations example.

#include "SDL.h"#include "SDL_opengl.h"int main( int arc, char* args[] ){	SDL_Surface* pSurfScreen = 0;	if( SDL_Init( SDL_INIT_VIDEO ) < 0) {		return 1;	}	atexit(SDL_Quit);	pSurfScreen = SDL_SetVideoMode( 640, 480, 32, SDL_OPENGL ); 	if ( !pSurfScreen ) 	{		return 1;	}	return 0;}
I got it to work about 5 hours after I posted this. For some reason I actually didn't have an entry point. The word main was gone from my project settings. That was really odd since I've never even seen that property, nor changed it.

Thanks anyway. :)

This topic is closed to new replies.

Advertisement