Sign in to follow this  

Starting OpenGL the right way?

This topic is 4559 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

I was wondering if anyone could point me in the direction of a good OpenGL tutorial. I do program, but mostly in 2D, and the NeHe tutorials are hard for me to understand because I am not using VC++. I am using Dev-C++ and Allegro for my graphcis library thus far. Any help would be much appreciated.

Share this post


Link to post
Share on other sites
I am not sure why the NeHe tutorials wouldn't suit you, as once you have the libraries set up ok the differences between using MSVC++ and Dev-C++ are tiny. Is there any part in particular you have a problem with?

Share this post


Link to post
Share on other sites
Hey kelcharge! Let's look at Lesson 1 of NeHe's tutorials. First let me point out that I used SDL for everything but graphics (openGL). Allegro should be fine, but you need to sort out it's includes and API functions yourself. Include the libraries for opengl32 and glu32. And for your code:


#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
/* ... other includes ... */

/* The next variables and LRESULT CALLBACK depend on your API. Replace them
with Allegro code. Again, I have never used Allegro, so sort these out
yourself. */


/* Put in <b>GLvoid ReSizeGLScene(GLsizei width, GLsizei height)</b> and it's definition if you want to resize */

/* This is essential: put in <b>int InitGL(GLvoid)</b> and its definition */
/* <b>int DrawGLScene(GLvoid)</b> and its definition */

/* The next part again depends on your API. For SDL the entire
KillGLWindow(GLvoid) function can be replaced by SDL_Quit(); ! */


/* Similarly for CreateWindow() */

/* Instead of WINAPI WinMain() use int main(int argc, char *argv[]) . start
from the if (!CreateGLWindow(..... line. And the rest of the code, to detect
keypresses and stuff all rests on Allegro's shoulders. */




There you go! I hope this helps you as I had to go through a lot of trouble writing it (looking at what NeHe said and all). Hey and when you get a working openGL project, make sure you show us!

Share this post


Link to post
Share on other sites
Quote:
Original post by kelcharge
I am using Dev-C++ and Allegro for my graphcis library thus far. Any help would be much appreciated.


what about this one:


ot this one: OpenGL+SDL(2D also, as good as Allergo)


or better use this:

Share this post


Link to post
Share on other sites
At the bottom of each and every lessons page of nehe is a list of ports to alternate IDEs and compilers. Just taking a glance at lessons 1 and 2, it would appear at least that lesson has a Dev-C++ version as well.

Download the code, locate the differences, and try and understand what's going on and you should be well on your way to success, and be able to create a project that will work for any of the examples, even if they don't have a Dev-C++ version listed.

Share this post


Link to post
Share on other sites
I hope you realize you can create an OpenGL project very easily in Dev-C++.

Go to

File -> New -> Project

Click on the Multimedia tab.

Select OpenGL.

Mike C.
http://www.coolgroups.com/zoomer/

Share this post


Link to post
Share on other sites
If you're already comfortable with C++ and have some money, then the book Beginning OpenGL Game Programming by Dave Astle, Kevin Hawkins is excellent (and only US$29.99).

After that move on to the OpenGL Programming Guide by Mason Woo, et al. Many people refer to this as the red book.


Also I don't have any experience with Allegro, but SDL has been easy to use for OpenGL. The NeHe Linux/SDL code provided at the bottom of each lesson should probably also compile fine on windows (though I've only tested it with linux).

Share this post


Link to post
Share on other sites

This topic is 4559 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this