Questions tagged [opengl]

OpenGL (Open Graphics Library) is a graphics standard and API which is platform independent and available for desktop, workstation and mobile devices. It is designed to provide hardware-accelerated rendering, and hence gives greatly improved performance over traditional software rendering. OpenGL is used for applications like CAD software and computer games. The OpenGL standard, as well as OpenGL ES, is controlled by the Khronos group.

OpenGL (Open Graphics Library) is an API used to interact with GPUs (Graphics Processing Units). Originally developed by SGI (Silicon Graphics Inc.) in the early 90's, the current API is being developed by the Khronos Group.

OpenGL is platform independent and available for desktop, workstation and mobile devices. It is designed to provide hardware-accelerated rendering and is typically used for applications such as CAD software and computer games.

The tag should only be used for questions about desktop OpenGL. OpenGL ES (OpenGL for Embedded Systems) and WebGL have their own tags - and . When posting in the tag, remember to always specify your target OpenGL version in order to get more precise answers. The tags , , and exist for this purpose.

Official Documentation

  • The Red Book - Tutorial GL
  • The Orange Book - Tutorial for GLSL
  • The Green Book - Tutorial for GLX
  • The Blue Book - API references for GL (out of print; replaced by online reference pages)
  • The White Book - Tutorial for WGL

Successor

Khronos Group announced API at GDC (Game Developers Conference) 2015. Vulkan, previously known as glNext or the "Next Generation OpenGL Initiative", is widely thought of as the successor to OpenGL and shares many similarities to the API. It is a complete redesign aimed to unify the OpenGL and OpenGL-ES API's into one common API that will not be backwards compatible.

External resources

Unofficial Tutorials

Books

Release Dates

  • OpenGL 1.0 - January 1992
  • OpenGL 1.1 - January 1997
  • OpenGL 1.2.1 - October 1998
  • OpenGL 1.3 - August 2001
  • OpenGL 1.4 - July 2002
  • OpenGL 1.5 - July 2003
  • OpenGL 2.0 - September 2004
  • OpenGL 2.1 - July 2006
  • OpenGL 3.0 - August 2008
  • OpenGL 3.1 - March 2009
  • OpenGL 3.2 - August 2009
  • OpenGL 3.3 - March 2010
  • OpenGL 4.0 - March 2010
  • OpenGL 4.1 - July 2010
  • OpenGL 4.2 - August 2011
  • OpenGL 4.3 - August 2012
  • OpenGL 4.4 - July 2013
  • OpenGL 4.5 - August 2014
  • OpenGL 4.6 - July 31, 2017
37973 questions
84
votes
4 answers

Passing a list of values to fragment shader

I want to send a list of values into a fragment shader. It is a possibly large (couple of thousand items long) list of single precision floats. The fragment shader needs random access to this list and I want to refresh the values from the CPU on…
Ville Krumlinde
  • 7,021
  • 1
  • 33
  • 41
83
votes
10 answers

Drawing Sphere in OpenGL without using gluSphere()?

Are there any tutorials out there that explain how I can draw a sphere in OpenGL without having to use gluSphere()? Many of the 3D tutorials for OpenGL are just on cubes. I have searched but most of the solutions to drawing a sphere are to use…
Carven
  • 14,988
  • 29
  • 118
  • 161
80
votes
3 answers

Python - No handlers could be found for logger "OpenGL.error"

Okay, what is it, and why does it occur on Win2003 server, but not on WinXP. It doesn't seem to affect my application at all, but I get this error message when I close the application. And it's annoying (as errors messages should be). I am using…
Paige Watson
  • 1,218
  • 3
  • 17
  • 27
78
votes
7 answers

How to get the GL library/headers?

#include #include #include This is an example, but where to get GL headers?
cdxf
  • 5,501
  • 11
  • 50
  • 65
72
votes
3 answers

What is so bad about GL_QUADS?

I hear that GL_QUADS are going to be removed in the OpenGL versions > 3.0, why is that? Will my old programs not work in the future then? I have benchmarked, and GL_TRIANGLES or GL_QUADS have no difference in render speed (might even be that…
Rookie
  • 3,753
  • 5
  • 33
  • 33
71
votes
4 answers

Understanding glm::lookAt()

I am following a tutorial to learn OpenGL in which they used glm::lookAt() function to build a view but I cannot understand the working of glm::lookAt() and apparently, there is no detailed documentation of GLM. Can anyone help me understand the…
Cashif Ilyas
  • 1,619
  • 2
  • 14
  • 22
70
votes
5 answers

Why does OpenGL use degrees instead of radians?

The OpenGL designers were never afraid of mathematics, and knowledge of linear algebra is essential for all but the simplest OpenGL applications. I think it can safely be assumed that OpenGL programmers are familiar with angles in…
Thomas
  • 174,939
  • 50
  • 355
  • 478
68
votes
4 answers

About OpenGL texture coordinates

I know that I must call one of the following before each call to glVertex: glTexCoord(0,0); glTexCoord(0,1); glTexCoord(1,1); glTexCoord(1,0); But I have no idea what they mean. I know, however, that if I multiply (or is that divide?) the right…
mk.
  • 11,360
  • 6
  • 40
  • 54
68
votes
11 answers

How to Practically Ship GLSL Shaders with your C++ Software

During OpenGL initialization, the program is supposed to do something like: Getting source code could be as simple as putting it in a string like: (Example…
Korchkidu
  • 4,908
  • 8
  • 49
  • 69
68
votes
3 answers

How does glDrawArrays know what to draw?

I am following some begginer OpenGL tutorials, and am a bit confused about this snippet of code: glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject); //Bind GL_ARRAY_BUFFER to our handle glEnableVertexAttribArray(0); //? glVertexAttribPointer(0, 3,…
w4etwetewtwet
  • 1,330
  • 2
  • 10
  • 20
66
votes
3 answers

Getting the true z value from the depth buffer

Sampling from a depth buffer in a shader returns values between 0 and 1, as expected. Given the near- and far- clip planes of the camera, how do I calculate the true z value at this point, i.e. the distance from the camera?
Hannesh
  • 7,256
  • 7
  • 46
  • 80
66
votes
2 answers

What is the difference between OpenCL and OpenGL's compute shader?

I know OpenCL gives control of the GPU's memory architecture and thus allows better optimization, but, leaving this aside, can we use Compute Shaders for vector operations (addition, multiplication, inversion, etc.)?
Maiss
  • 1,641
  • 4
  • 18
  • 23
65
votes
11 answers

What is the best way to debug OpenGL?

I find that a lot of the time, OpenGL will show you it failed by not drawing anything. I'm trying to find ways to debug OpenGL programs, by inspecting the transformation matrix stack and so on. What is the best way to debug OpenGL? If the code looks…
dreamlax
  • 93,976
  • 29
  • 161
  • 209
65
votes
2 answers

Camera position in world coordinate from cv::solvePnP

I have a calibrated camera (intrinsic matrix and distortion coefficients) and I want to know the camera position knowing some 3d points and their corresponding points in the image (2d points). I know that cv::solvePnP could help me, and after…
nkint
  • 11,513
  • 31
  • 103
  • 174
65
votes
2 answers

Rendering meshes with multiple indices

I have some vertex data. Positions, normals, texture coordinates. I probably loaded it from a .obj file or some other format. Maybe I'm drawing a cube. But each piece of vertex data has its own index. Can I render this mesh data using…
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982