I am trying to install opengl on windows 8 64 bit machine I did not find any libraries containing gl.h glu.h files I found glut libraries/headers...,Through some stack overflow posts I came to know that opengl is a part of windows then where is it found.help
-
OpenGL is included with your driver (I assume) but there's no SDK for it on Windows. There are various libraries you can use like SFML that make getting started with it a bit easier. – Robinson Jan 16 '15 at 15:26
-
Please make your question a bit clearer. – MKII Jan 16 '15 at 15:27
-
No need to mark it down. It's the kind of question a complete beginner would ask. – Robinson Jan 16 '15 at 15:27
-
@Robinson It is quite unclear what he means though. – MKII Jan 16 '15 at 15:29
-
1possible duplicate of [How to get the GL library/headers?](http://stackoverflow.com/questions/3933027/how-to-get-the-gl-library-headers) – Axalo Jan 16 '15 at 15:29
-
2@Robinson: I'm getting a little tired of this fundamental misunderstanding being repeated all over the site: the downvotes (not "mark downs" — you've been here for four years; learn the lingo) are for a poor and unclear question with no evidence of substantial research effort, not just because he's a beginner. – Lightness Races in Orbit Jan 16 '15 at 17:16
-
OK mate. The site must remain comprehensible of course. – Robinson Jan 19 '15 at 11:49
3 Answers
OpenGL-1.1 has been part of the Win32 ABI (ABI = Application Binary Interface, i.e. the set of functions guaranteed to be available and specification how these are to be called by the compiler (calling conventions)) since Windows-NT4 (and got included retroactively into Windows 95-B).
As such every compiler toolchain that targets the Win32 API (which BTW also covers 64 bit versions) must include the necessary symbol declarations (headers in C) and API linkage stubs. Or in other words: There's no need to download or install anything to develop for OpenGL.
Never(!), I repeat, never(!), download anything named opengl32.dll
, opengl32.lib
, gl.h
, wgl.h
or similar and don't even think about replacing the perfectly fine files you already have with them; doing so will just break your system (either the operating system or the compiler toolchain). It's unnecessary and actually harmful to do so. Hence the page you thought giving you good information is in fact very harmful. Completely disregard its information.
OpenGL itself is not a library, but a specification which so called implementations follow. The OpenGL implementations for Windows are part of the graphics cards' drivers! There's also a software rasterizer fallback that covers OpenGL-1.1 in case no graphics card support is available. Note that modern OpenGL support is not included in the drivers installed through Windows Update; GPU drivers with OpenGL support must be downloaded directly from the GPU vendor's website and installed manually.
Functionality that goes beyond OpenGL-1.1 in Windows must be loaded at runtime through the so called "extension mechanism". Since this is a tedious process there are several 3rd party libraries that get this job done. The most popular is probably GLEW but it has a number of issues.
(EDIT for further clarification:) It is notable, that nothing beyond the functions already provided by the Windows OpenGL-1.1 ABI (i.e. the WGL API as it was specified for Windows-NT4) is required to get access to even the most modern OpenGL features. Of course newly introduced function pointer types and numeric token values must be defined somehow so that they can be used in source code, but there is no "mandated" way (i.e. library) to do it. This makes it possible that a program which makes use of – for example – pure modern OpenGL-4 core profile that could be built with Visual C++ 4 (VC++ 4 got released in 1995), assuming it uses only language features and OS APIs that were available back then. The actual steps to create modern OpenGL contexts in Windows are pretty well documented at the OpenGL Wiki and the reader is referred to this resource as elaborating on the details here would largely leave the scope of this answer.
Also OpenGL itself does not deal with creating windows, handling user input and the likes. You can of course program against the native OS API for doing that. But often you just want to use some framework. Popular choices for OpenGL development are GLFW, FreeGLUT, SDL2 and SMFL.

- 159,371
- 13
- 185
- 298
-
Great answer, I would add that functions could be loaded by symply including generated files without even using any libs https://bitbucket.org/alfonse/glloadgen/wiki/Home – Kimi Jan 16 '15 at 16:58
-
What if you want to use a version of OpenGL that is not two _decades_ old? – Lightness Races in Orbit Jan 16 '15 at 17:18
-
@LightnessRacesinOrbit: I answered that in the second to last paragraph. OpenGL provides a mechanism for loading extensions and extended functionality (the extension mechanism) by which modern features are accessed. – datenwolf Jan 16 '15 at 17:35
-
@datenwolf: And all features of OpenGL 3, for example, can be used in entirety via OpenGL 1.1's extension system? – Lightness Races in Orbit Jan 16 '15 at 17:49
-
@LightnessRacesinOrbit: The extension mechanism is basically just a call to GetProcAddress(...) with the symbolic name(s) from the OpenGL header file. If you get an address the function is implemented, if not it isn't. The mechanism covers both Core and Extension(s) to OpenGL. – Richard Critten Jan 16 '15 at 18:35
-
@LightnessRacesinOrbit: Not just "can". The right term is "must". The extension mechanism is the *only* way to access functionality beyond OpenGL-1.1; truth to be told I'd largely prefer it, if even OpenGL-1.1 had been loaded at runtime dynamically, since this would have avoided a lot of confusion in the first place. – datenwolf Jan 16 '15 at 18:41
-
@Richard I'm asking whether this mechanism is sufficient to get access to the full OpenGL 3 API. Seems like the answer is "no"; if so, not sure why datenwolf is trying to obscure that fact! – Lightness Races in Orbit Jan 16 '15 at 18:55
-
@LightnessRacesinOrbit: The answer is a resounding **YES**. Nothing else like the plain OpenGL-1.1 extension mechanism that has always been available is required. No need for extra libraries. Of course using the plain extension mechanism is tedious work so you normally want to use a wrapper library that does the boring stuff for you. But if you don't want to use that library, you can get OpenGL-3 or later just with what the compilers for Windows ship with. – datenwolf Jan 16 '15 at 21:07
-
@LightnessRacesinOrbit: To create a OpenGL-3 core profile context you have to jump a few hoops (you must first create a proxy context so that you can load extensions). But all these hoops are available through the APIs that were already available when OpenGL-1.1 shipped with Windows-NT4. If you want to take a look at the hoops to jump, look here https://github.com/datenwolf/wglarb/blob/master/wglarb.c (*Note that this little library does a little more than just the absolute minimum; most importantly it adds synchronization to be thread safe). – datenwolf Jan 16 '15 at 21:10
-
@LightnessRacesinOrbit: Of course for any entry point that got introduced later you'll have to provide the right type definitions and function pointer variable to store the address to. But then the functions pointers (in Windows) depend on the context being active, so you can't use global symbols for that anyway. Type definitions matching the requirements of the platform are published on opengl.org/registry (`glext.h` and `wglext.h`), but these should be copied to the project source tree, although you can often find them installed at a global location. – datenwolf Jan 16 '15 at 21:16
-
Add this crucial detail to your answer, and you're golden. – Lightness Races in Orbit Jan 17 '15 at 07:18
-
1@LightnessRacesinOrbit: I added a paragraph – hesitantly, because I feel that our discussion and that additional information is already on the fringes of information the original question asked about. Also I feel that a careful reader of my answer would have understood this without having that (IMHO highly redundant) paragraph there. IMHO the quality of the answer got degraded by adding that paragraph. – On a personal note: I browsed through a number of your comments and I get the impression (and I could be very wrong here), that you may think its your duty to make people answer in your style. – datenwolf Jan 17 '15 at 10:52
-
@datenwolf: You are _extremely_ wrong. What does this have to do with "my style"!? What I am saying here is that in my view you did not fully answer the question before adding that paragraph. You may disagree with that if you like but do not start flinging around hurtful accusations because of it. – Lightness Races in Orbit Jan 17 '15 at 16:32
Short answer: Install your compiler, find an OpenGL tutorial for that compiler. (eg. Google: Visual Studio OpenGL tutorial) And get started. No more downloads needed. It's included with the compiler.
The Long Answer:
The OpenGL SDK is not something you install. The Basic SDK (OpenGL 2.1) should come prepackaged with any standard compiler (Visual Studio, and GCC both do.)
You should be able to use the prepackaged version by using #include <gl/gl.h>
, and adding the appropriate libraries to your lib path (Those libraries also come with the compiler. You should be able to find tutorials on this.)
To use any version of OpenGL above 2.1, does not require a library either. You use wglGetProcAddress(...)
to get appropriate functions to allow you use of those functions, IF THEY ARE SUPPORTED. Even then though, you still need to create an OpenGL 2.1 context.
However, to easily use OpenGL3, you might want to download the gl3.h
header. However, there is no gl3.lib
file to download. You just use the libs that come with your compiler.
The reason for this is because OpenGL is not implemented in an SDK. It's implemented in the driver for your graphics card, and your program communicates directly with the driver. Starting with a basic API for querying supported functions and the pointers to those functions, so you can call them.

- 1,338
- 1
- 13
- 26
GLUT does that for you, you don't need to include it yourself. It seems like there's an issue with your set up. There are also other libraries that can be used in place of GLUT, but you need to use one of them, since you can't deal with OpenGL directly.

- 892
- 11
- 36
-
I have made glut set up but when i try to compile The following error occurs gl/gl.h: no such file or directory – Jan 16 '15 at 15:30
-
I don't have any personal experience with GLUT (I have only used freeGLUT), so I can't help with setting it up, sorry. I wouldn't recommend using it though (it is old and not actively maintained, and can be difficult to set up). – MKII Jan 16 '15 at 15:33