14

I want to be able to compile OpenGL4.1 (C/C++) applications from VisualC++ 2010.

After doing a search I only found: http://www.opengl.org/sdk/ and the documentation: (which is fine) http://www.opengl.org/sdk/docs/man4/

Which is a bit confusing, and I really don't know what to install to get started. I can't even find a download link, or what OpenGL projects I should use.

1

3 Answers 3

18

You don't need to download anything to use OpenGL. Just add

#include <gl/GL.h>
#include <gl/GLU.h>

to the top of your source file. And you also need to link the libraries, which in MSVC can be done like this:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

With the header files provided with microsoft, you are stuck with version 1.1 of ogl. I suggest getting the latest extension headers from the OpenGL website, as well as something like GLEW. This will give you access to the latest available functions and constants in OpenGL.

6
  • 6
    +1 -- if you're going to use a recent version of OpenGL on Windows, GLEW or GLEE is essential. Commented Feb 20, 2011 at 5:18
  • 1
    They're not really essential, doing the stuff GLEW and GLEE do is just boilerplate and can be done quite easily with custom code. It's just annoying to do. But sometimes there's no other way than doing it on your own, e.g. when implementing language bindings.
    – datenwolf
    Commented Feb 20, 2011 at 11:42
  • Thanks for the info. Appreciate the GLEW/GLEE extra suggestion
    – Ron
    Commented Feb 20, 2011 at 13:04
  • 1
    @datenwolf: yes -- I originally wrote "essentially essential", but decided that sounded wrong. Maybe "virtually essential" would have been better. Bottom line: yes, it's possible to get by without them, but based on the original question, I'd strongly advise against trying. Commented Feb 20, 2011 at 16:20
  • @Jerry Coffin: Yes, I also recommend using GLEW/GLEE. But some frameworks, like GLFW do implement their own extension loader mechanism.
    – datenwolf
    Commented Feb 20, 2011 at 17:37
7

I believe the windows sdk includes opengl. Just include windows.h before including GL/gl.h

http://www.opengl.org/resources/faq/technical/gettingstarted.htm

Search 2.070

0

For Windows you have to use the SDK form the manufacturer of your graphics card. For Nvidia SDK is available for free download, for registered users. The OpenGL SDK link that you have shown IMO is only the specification, just like how OpenGL is only the API specification.

3
  • Not sure how you got this impression. I use OpenGL on Windows, and have never downloaded any SDK from a graphics card manufacturer. Commented Jul 15, 2014 at 16:12
  • @ Retro Koradi: Windows supports OpenGL 1.1 and not higher versions. Is there any other method to use higher version without SDK from graphics manufacturer?
    – Divakar
    Commented Aug 2, 2014 at 11:04
  • The supported OpenGL version on a Windows machine is determined by the graphics driver. As long as you have a recent GPU and the latest driver for it, it will support the very latest OpenGL (which is 4.4 at this moment). It may look like it only supports 1.1 if you look at the header files in the Windows SDK, but you can get any entry point supported by the GPU/driver with wglGetProcAddress(). There are various tools, like GLEW, that handle this for you if you don't want to deal with it yourself. Commented Aug 2, 2014 at 11:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.