PDA

View Full Version : How to get started with open GL



opennewb
04-30-2014, 02:03 PM
I am learning open Gl Application development. I am using windows 8 and vs 2012. My first question is why can visual studio not find the libraries need to run the open gl application? I went to the open gl website to find the libraries but I cant seem to find them. How do i download the libraries? And What libraries do I need once i get them? And Where should i put them once i get them? Then last but not least how do link my them to my application.

opennewb
04-30-2014, 02:52 PM
Ok With a little digging i found that Open Gl doesnt have a SDK. It supportes extention libraries such as glee, glut, openglut, closedglut, JoeGlut and SDLglut. Ok my Im joking if you didnt guess. But my question is this. What extentions should i use? Which one is better. Once i decide which one im going to use, How do I use it? Thanks in advance.

mhagain
04-30-2014, 04:01 PM
Out-of-the-box you can build and run simple OpenGL 1.1 programs. You use the Windows API for creating your window, setting up pixel formats and handling events, include <gl/gl.h> and link to opengl32.lib - these are all included with all versions of Visual Studio (warning: if using Express make sure it's Express for Windows Desktop) and in all Windows SDKs.

Would you like to know more? See http://www.opengl.org/wiki/Getting_Started

GLUT, SDL, GLFW, etc are not necessary but they can be used to simplify the task of creating a window and handling messages. What was 100+ lines of Windows API code can become 2 or 3 lines of GLUT code, for example.

GLUT is probably the simplest but is quite limited. It's good enough to get your first window up and running, however, so you generally see it used by tutorial material and if you're learning it's therefore advised to be familiar with it. GLUT itself is no longer updated but a variant called FreeGLUT (you can essentially treat it as identical for these purposes) is available.

Would you like to know more? See http://www.opengl.org/wiki/Related_toolkits_and_APIs#Context.2FWindow_Toolkit s

From there you'll probably want to access functionality higher than GL 1.1 otherwise you'll be learning the old out-dated stuff that nobody uses any more, so you need an extension loading library. GLEW is the one I favour, although others exist.

Would you like to know more? See http://www.opengl.org/wiki/OpenGL_Loading_Library

You'll probably want to get some tutorials. The NeHe tutorials are well-regarded but unfortunately they're also heavily out-dated and will teach you bad habits and the wrong way of doing things. The OpenGL wiki "Common Mistakes" pages could have been written with them in mind.

Would you like to know more? See https://www.opengl.org/wiki/Common_Mistakes and https://www.opengl.org/wiki/Common_Mistakes:_Deprecated

Instead the recommended resource is the "Learning Modern 3D Graphics Programming" set of tutorials on Arcsynthesis. These will get you up and running with the right way of doing things from the outset.

Would you like to know more? See http://www.arcsynthesis.org/gltut/

And I think that's probably enough to get going with.

opennewb
05-04-2014, 12:06 PM
Thanks I appreciate the helpful information. I recently Bought a book called Beggining OpenGL game Programming. Ill admit its a little dated but not by much. When I try the source code from the cd I cant get any of it to work. VS 2012 compile errors are saying that it cant open <SDL/SDL.h>, GL/GL.h and a few others. also Ill try to link into the include file thats on the cd sometimes the error will go away but then it says c.sc is not defined. or some struct is not declared. GDUSERDATA is not declared. and so forth. What am I doing wrong Should i just cann the Idea of running the Source code from the book I bought and start from scratch. Is there a certain way to link libraries. Really i just want to get one triangle on the screen Then I can retire call myself a 3D developer and look back at all the Great things i have done in my life. Thanks again. OpenNewb.

opennewb
05-05-2014, 12:43 PM
Well after many sleepless nights scratching my head about this issue. I believe i have found a solution to my problem. I have to include the dll file in the same folder where your exe will reside, whether its a release build or a debug. You'll have to do this with SDL Glew and all of the extention packages. Also there is a good tutorial on youtube on how to set up OPENGl in windows using VS You can find the series here http://www.youtube.com/channel/UCnlpv-hhcsAtEHKR2y2fW4Q Now i have another problem. If youve seen the tutorial series I made it all the way until builing an opengl hello world window and I have no typos but when i build the solution it gives me an unable to link external symbols errors. Maybe I need to download the latest drivers for nvidia. I dont know, Ill let you guys know how it goes.

overTaker
05-06-2014, 12:41 AM
I, by myself use Glew and Glfw libraries, they have .lib binaries attached with them as far as I remember, they all have to be linked, but don't forget about linking OpenGL lib as well.
My linking list in Visual Studio looks like this:


libopengl32.a
glew32.lib
glfw3.lib
glfw3dll.lib


Also all the headers I use are glew.h and glfw3.h. Also, it is required to put two dll libraries that come with glew and glfw to your exe directory. This is the only thing I was required to do, to make simpliest OpenGL application to work.