# OpenGL OpenGL and Visual C++ (not a rehash)

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

## Recommended Posts

I know there are a lot of posts that are related to this issue, however I just can't figure it out. I tried learning OpenGL this last summer and dropped it, not because I didn't understand the content, but because I just couldn't get the libraries set up right.

I'm giving OpenGL another shot, because I'm trying to develop GUI for a data analysis program that I am writing and it seems like the best option for what I am trying to do. After this project, I want to move on to programming more fun applications, not for work I am trying to set up OpenGL with Microsoft Visual C++ 2010. But again, I just can't get it right.

I have followed the online tutorials to set it up and I don't understand what I'm doing wrong. With my questions I'm going to start at square one so I don't mess anything up. I re-installed my Visual C++ IDE fresh as well to make sure that everything is downloaded correctly. I am working on a Studio Laptop with Windows 7 and a 64-bit Operating System (that may be repetitive).

Here are my specific questions:

-Where should I get my OpenGL library?
-Which libraries should I get (GLUT,GLU, GLAUX,etc...)?
-Where should I put my library on my computer in order to reference it (w/ #include ...)?

More general questions:

-Can you think of anything that I am missing?
-Is there something that I need to do within Microsoft Visual C++ 2010 outside of the actual text of the code to include the OpenGL correctly?

Please don't dismiss me as a programming illiterate. I don't know where I fall as a C++ programmer. And, I don't think I am terribly advanced. However, I understand the language well enough to write sequence analysis programs for my research. I have a good grasp of all the fundamentals of programming in C++. However, I have very little experience working with GUI libraries. This is something that I want to learn, and something that I am willing to put the time into learning. I just can't seem to get off the ground and I need some help.

##### Share on other sites

1) Where should I get my OpenGL library?
2) Which libraries should I get (GLUT,GLU, GLAUX,etc...)?
3) Where should I put my library on my computer in order to reference it (w/ #include ...)?

1) You do not need to get anything (dll comes with every windows out of the box, relevant lib/h is included in VC)
2) GLUT is dead (might want to use freeGLUT instead), GLAUX was already dead when i first heard about Gl. GLU you might find useful, but is not strictly needed. As you are new, i would suggest GLEW as otherwise you will be stuck in ancient OpenGl (It is an extension loader).
3) It is up to you. I use a per project folder so i can choose per project which exact version i use of any given library.

Usage is very simple: http://glew.sourceforge.net/basic.html

##### Share on other sites
Thought i give one possible setup example:
 #define GLEW_STATIC // adding the libs in source for convenience. #pragma comment(lib,"opengl32.lib") // already present in VC #pragma comment(lib,"glew_lib_file.lib") // lib needs to be in standard lib folders (32bit one in ".../VC/lib" and 64bit one in "../VC/lib/amd64"). // or use this trick: __FILE__ "/../../../etc/path_to_somewhere_else/my_project_specific_copy_of_glew.lib" #include "wherever_you_put_them/glew.h" #include "wherever_you_put_them/wglew.h" // or "#indluce <glew.h>" etc, if you drop them in "../VC/include" bool initializeGLEW() { GLenum err = glewInit(); return err == GLEW_OK; } 

##### Share on other sites

1) You do not need to get anything (dll comes with every windows out of the box, relevant lib/h is included in VC)
2) GLUT is dead (might want to use freeGLUT instead), GLAUX was already dead when i first heard about Gl. GLU you might find useful, but is not strictly needed. As you are new, i would suggest GLEW as otherwise you will be stuck in ancient OpenGl (It is an extension loader).
3) It is up to you. I use a per project folder so i can choose per project which exact version i use of any given library.

Usage is very simple: http://glew.sourceforge.net/basic.html

Wow, shows how much I know. I didn't know GLUT was dead. How do you suggest that I now go about learning GLEW? Do you recommend any tutorials?
Thank you for the quick and informative answer.

##### Share on other sites

1) I didn't know GLUT was dead.
2) How do you suggest that I now go about learning GLEW? Do you recommend any tutorials?
Thank you for the quick and informative answer.

1) Went to refresh my memory when it last saw an update - surprisingly difficult to track down x_x. Definitely ~12 years ago tho, which given how much Gl has advanced since ... yeah, pretty dead (this does not mean that it does not work - it does work). freeGLUT is made to work very similarly afaik, so that should help on tutorial front. I have never used neither of thous - opting to create a gl context etc myself (probably not recommended as it creates a fairly major learning curve speed-pump at the very start).

Doing some OGL stuff goes roughly like this:
* get a window with a device context capable of accelerated opengl => freeGLUT helps you out there.
* initGlew() - to get the gl* function pointers to actually point to their implementations, if supported.
* create some message loop for the window in which you call your redraw function => freeGLUT helps you out there.
* in redraw function: do what you want .
And that is pretty much it.

2) GLEW just loads all the extensions (The OpenGl version in Windows is locked down to 1.1 [1.2? can not remember exactly]] - so, pretty much everything needs to be loaded, including all the core functionality). GLEW does that all for you. It also provides boolean flags to check for non-core extensions (OGL 3.3 is powerful enough that you probably never even need any) - and if they return true then you can also use all of thous functions.

There really is nothing to learn there. It is needed just so that you could actually call the majority of the gl* functions.

A great tutorial for graphics in general (ie, not stuck in OGL 1.* mindset like the NeHe series), based on up to date (the internet tends to be riddled with horribly ancient stuff) opengl, is: http://www.arcsynthesis.org/gltut/
It also introduces the GLM library which is quite recommended.

##### Share on other sites

A great tutorial for graphics in general (ie, not stuck in OGL 1.* mindset like the NeHe series), based on up to date (the internet tends to be riddled with horribly ancient stuff) opengl, is: http://www.arcsynthesis.org/gltut/
It also introduces the GLM library which is quite recommended.

Thank you again for being so helpful! This is great! I have started going through the tutorial and I have already run into problems with premake4. Would it be alright if I P.M. you so I don't keep bumping this thread?

EDIT: Problem solved, only to run into a new problem. The "frameworkD.lib" file is not supported ["Unable to start program 'C:\...\framework\lib\frameworkD.lib'. The specified file is an unrecognized or unsupported binary format."] That doesn't make sense to me. Any ideas?

1. 1
2. 2
JoeJ
17
3. 3
4. 4
5. 5
frob
11

• 13
• 16
• 13
• 20
• 12
• ### Forum Statistics

• Total Topics
632178
• Total Posts
3004608

×