Sign in to follow this  
forestlaw89

Now that I am familiar with C++ what graphics language should I learn?

Recommended Posts

Well, I have just finished with the book "Beginning C(plus plus) Game Programming" by Michael Dawson. I really understand the concepts in the book and now I wan't to get started with learning a Graphics language. I have heard of many like Allegro, SDL, DirectX, and openGL. But, unfortunately I don't know which one to start with. Every forum I go to there is a different suggestion for a beginner level Graphics language. So, my friends I ask for your help to point me into the right direction. Please let me know what is your suggestion for a Graphics language, with an explanation of course. Also it would be appreciated if you gave me a link to a tutorial for that language with your responses. Thanx major in advance.

Share this post


Link to post
Share on other sites
They aren't seperate languages, they're graphics libraries (well Allegro, SDL and DirectX are more than just graphics). Personally, I recommend SDL, it's relatively simple but can do a lot. If you've just finished a beginners programming book, you'll probably need to do a lot of cut and paste work with DirectX and not really understand what you're doing. Similarly OpenGL has a lot of voodoo bits as well, plus you have to deal with the fact you need to use another library to generate the window that GL will use. Allegro isn't a bad choice for a beginner either, I just prefer SDL personally.

Share this post


Link to post
Share on other sites
This was asked recently it seems best fitting to say it really depends on you.

You can learn SDL but its not exactly the same as OpenGL or DirectX so assuming you wish to change later on it might take a bit longer.

I personally have found that OpenGL is easier to learn initially, but perhaps harder with more advanced concepts. DirectX on the other hand I have found is harder to learn in the beginning but easier later on.

I learned OpenGL off NeHe's site the basics first. Then I switched to DirectX shortly after. It really depends on what you can handle though. Reason I think I found OpenGL easier at first was because there was not as much info online about programming specific things in DirectX and I was familiar with NeHe. Therefore I went from there.

Reasons I found OpenGL harder later are on are due to the fact it requires more math knowledge then DirectX. Seeing as DirectX has a lot of built in functions to handle some of the math for you. How ever DirectX being built off COM can be somewhat tedious to learn initially.

Share this post


Link to post
Share on other sites
There is no "best" choice. Just try out a few options and choose whatever works best for you. Be aware though, that SDL, Allegro and DirectX (the whole bunch, including the Direct3DX tool libraries) offer much more than just a single API for handling graphical stuff.

OpenGL by itself only deals with the lowest level aspects of a 3D API. You will have to do much work yourself (e.g. creating an output window, binding a rendering context to it and loading data such as textures and geometry) or use another library like GLUT that does the grunt work for you.

I've found that, while the idea of simply using SDL or Allegro seems appealing at first, it can be quite frustrating for a beginner to set those libraries up in your IDE since they are quite complex. There's pro's and con's with either approach - so just try a few options and judge for yourself.

Your choice also depends on your aim - if you want to learn the general mechanisms behind any 3D API, OpenGL + GLUT seems like a good option to me. A simple GLUT program can be setup by including just one header and writing three functions:

// Sample GLUT program
#include <GL/glut.h>

namespace {

void render( ) {
// use GL calls to clear the screen and reset the view matrix
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity();

// use OpenGL calls to render your scene here.

// display scene by swapping buffers (this sample uses double buffering)
glutSwapBuffers();
}

void timer( int /* unused */ ) {
// tell GLUT to call "render"
glutPostRedisplay( );
// set the timer to be called again in about 50ms
glutTimerFunc( 50, timer, 0 );
}

void initGL( ) {
// clear the projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity( );
// setup the projection matrix - e.g. orthographic projection
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
// set additional states, e.g. enable backface-culling
glEnable( GL_CULL_FACE );
}

}

int main( int argc, char ** argv ) {

// initialise
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );

// create a 512x512 window
glutInitWindowSize( 512, 512 );
glutCreateWindow( "Hallo Welt!" );
// set the render callback
glutDisplayFunc( render );
// !OPTIONAL! add a timer for fixed rate rendering @~20FPS
glutTimerFunc( 50, timer, 0 );

// set the intial OpenGL rendering state(s)
initGL();

// run the program
glutMainLoop();

return 0;
}


IMHO there is no easier way to take a glimpse into the exciting world of (3D) graphics programming [smile].

Good luck!
Pat

Share this post


Link to post
Share on other sites

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