Sign in to follow this  
ozzoright

Using OpenGL With Dev-C++

Recommended Posts

Hi, I just got "Beginning OpenGL Game Programming" and love it. However, I can't get OpenGL set up. The book uses Visual Studio as the IDE so... I'll probably have trouble compiling things (It's a shame most books don't use ANSI C++). Can anyone help me or point me in the right direction. Thanks.

Share this post


Link to post
Share on other sites
I use Dev-C++ for all my projects, most use OpenGL.
You need to include the header files for OpenGL like
#include <gl/gl.h>
#include <gl/glu.h>
I think that bit is the same as in Visual Studio. Then you need to include the libraries. You do this by going to Project Options in the Project menu then the Parameters tab. Click Add Library or Object and select the libraries there. They are libopengl32.a and libglu32.a.

Also, if your project type is set to Console Project you will need to use the library libgdi32.a or you will get a linker error saying "undefined reference to SwapBuffers" or something.

Then you should be able to use OpenGL as in Visual Studio.

I hope this helps.

Share this post


Link to post
Share on other sites
Thank you. That did help, but I still can't get it started :(. I really suck at the whole API thing. I couldn't get SDL started either. I could give it a break and try another time, I just don't know what to do.

Share this post


Link to post
Share on other sites
When I started learning OpenGL I used the tutorials on www.gametutorials.com beacause they mostly all had Dev-C++ ports. Since then, the ports have gone and they have started charging money for their tutorials. They still offer some free tutorials however. Try downloading their free first OpenGL program tutorial
Here

Then you need to do 2 things to get it running in Dev-C++. Make a new project and include the main.cpp file into it, then delete the 2 #pragama lines at the top and add the 2 libraries (libglu32.a, libopengl32.a) in the Project Options, Parameters window.

Share this post


Link to post
Share on other sites
Quote:

The book uses Visual Studio as the IDE so... I'll probably have trouble compiling things (It's a shame most books don't use ANSI C++)


The code itself is valid and doesn't use any Microsoft-specific extensions (though it may use #pragmas that Dev-C++ doesn't support in leiu of the usual include guards or to link with libraries), so it should compile just fine under any correctly-installed compilers such as the mingw one used by Dev-C++. It's setting up the project that's going to be different and there's no "ANSI C++" way to do that.

The biggest problem you'll run into is that Dev-C++ wants libraries compiled to different binary format (last I checked), but they have that nifty package updating thing that should let you nab the right ones. Others have covered the other implementation details better than I could already.

Share this post


Link to post
Share on other sites

Quote:
The book uses Visual Studio as the IDE so... I'll probably have trouble compiling things (It's a shame most books don't use ANSI C++)
{C}
{C}{C}

The code itself is valid and doesn't use any Microsoft-specific extensions (though it may use #pragmas that Dev-C++ doesn't support in leiu of the usual include guards or to link with libraries), so it should compile just fine under any correctly-installed compilers such as the mingw one used by Dev-C++. It's setting up the project that's going to be different and there's no "ANSI C++" way to do that.

The biggest problem you'll run into is that Dev-C++ wants libraries compiled to different binary format (last I checked), but they have that nifty package updating thing that should let you nab the right ones. Others have covered the other implementation details better than I could already.

 

post-220087-0-84752300-1398567222.png

Share this post


Link to post
Share on other sites

1) This topic is 8 years old, and the original poster is likely long gone -- they certainly won't still be stuck on a problem this old.

 

2) Just like the other two topics you posted it in (where I've since hidden the posts) your screenshot isn't even remotely helpful, and in the other topics not even relevant.

 

If you have something useful to say go ahead, but if you just want to share an unhelpful and barely relevant screenshot repeatedly you can knock it off -- you're just wasting your own time and the time of others.

Edited by jbadams

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this