Jump to content
  • Advertisement
Sign in to follow this  
Sirisian

OpenGL [VC++8] SDL and OpenGL

This topic is 4214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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 )

Share this post


Link to post
Share on other sites
(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;
}

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!