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
43
votes
5 answers

OpenGL without X.org in linux

I'd like to open an OpenGL context without X in Linux. Is there any way at all to do it? I know it's possible for integrated Intel graphics card hardware, though most people have Nvidia cards in their system. I'd like to get a solution that works…
Cheery
  • 24,645
  • 16
  • 59
  • 83
43
votes
1 answer

What does sampler2D store?

I've read a texture example in OpenGL 2.1. The fragment shader looks like this: #version 120 uniform sampler2D texture; varying vec2 texcoord; void main(void) { gl_FragColor = texture2D(texture, texcoord); } The texcoord is passed from vertex…
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
42
votes
4 answers

Generating a normal map from a height map?

I'm working on procedurally generating patches of dirt using randomized fractals for a video game. I've already generated a height map using the midpoint displacement algorithm and saved it to a texture. I have some ideas for how to turn that into a…
Dawson
  • 2,673
  • 1
  • 16
  • 18
42
votes
2 answers

Performant 2D SDL or OpenGL graphics in R for fast display of raster image using rdyncall package and SDL/OpenGL calls

In R, it seems none of the currently available options (e.g. image) allow for fast real-time display of 2D raster graphics. I was interested for example to make a real-time interactive Mandelbrot viewer, where I was hoping to display 1920x1080 raw…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
42
votes
1 answer

When should I use indexed arrays of OpenGL vertices?

I'm trying to get a clear idea of when I should be using indexed arrays of OpenGL vertices, drawn with gl[Multi]DrawElements and the like, versus when I should simply use contiguous arrays of vertices, drawn with gl[Multi]DrawArrays. (Update: The…
Jonathan Hartley
  • 15,462
  • 9
  • 79
  • 80
42
votes
2 answers

How exactly does OpenGL do perspectively correct linear interpolation?

If linear interpolation happens during the rasterization stage in the OpenGL pipeline, and the vertices have already been transformed to screen-space, where does the depth information used for perspectively correct interpolation come from? Can…
AIGuy110
  • 1,025
  • 1
  • 10
  • 11
42
votes
4 answers

When should glVertexAttribPointer be called?

It's not obvious from the documentation when glVertexAttribPointer should be called. It looks like it's part of VBO initialisation, but I notice example code calling it during rendering. glVertexAttribPointer(vertexAttributeId, 2, GL_FLOAT,…
Mark Ingram
  • 71,849
  • 51
  • 176
  • 230
42
votes
3 answers

What is the proper way to modify OpenGL vertex buffer?

I'm setting up a vertex buffer in OpenGL, like this: int vboVertexHandle = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle); glBufferData(GL_ARRAY_BUFFER, vertexData, GL_DYNAMIC_DRAW); Later, if I want to add or remove vertices to…
Mossen
  • 1,275
  • 2
  • 12
  • 15
42
votes
5 answers

How to render offscreen on OpenGL?

My aim is to render OpenGL scene without a window, directly into a file. The scene may be larger than my screen resolution is. How can I do this? I want to be able to choose the render area size to any size, for example 10000x10000, if possible?
Rookie
  • 4,064
  • 6
  • 54
  • 86
41
votes
6 answers

How to do ray tracing in modern OpenGL?

So I'm at a point that I should begin lighting my flatly colored models. The test application is a test case for the implementation of only latest methods so I realized that ideally it should be implementing ray tracing (since theoretically, it…
j riv
  • 3,593
  • 6
  • 39
  • 54
41
votes
4 answers

Is 0 a valid OpenGL texture ID?

glGenTextures(1, &textureid); Assuming that the texture was created succesfully, could textureid be 0?
Tal Pressman
  • 7,199
  • 2
  • 30
  • 33
40
votes
11 answers

OpenGL 4.x learning resources

I know there are some question about learning OpenGL. Here is what I know: math for 3D 3D theory Here is what I want to know: - OpenGL 4.0 Core profile (or latter) - Shader Language 400 (or latter) - every part of above (if it do not work…
przemo_li
  • 3,932
  • 4
  • 35
  • 60
40
votes
7 answers

How to do OpenGL live text-rendering for a GUI?

I'm implementing a GUI built on top of OpenGL. I came to the problem that each GUI will have -- text rendering. I know of several methods of rendering text in OpenGL, however, I'm wonderin which of them would be best suited for a GUI. Generally in a…
Kornel Kisielewicz
  • 55,802
  • 15
  • 111
  • 149
40
votes
2 answers

X hangs up because of application (use C++, Qt, OpenGL)

My application gets data from the network and draws it on the scene (scene uses handmade OpenGL engine). It works for several hours. When I'm not using my desktop, my monitor, because of Display Power Manager Signaling (dpms) turns off. And then,…
poljak181
  • 585
  • 4
  • 12
39
votes
6 answers

Learning modern OpenGL

I am aware that there were similar questions in past few years, but after doing some researches I still can't decide where from and what should I learn. I would also like to see your current, actual view on modern OpenGL programming with more C++…
Neomex
  • 1,650
  • 6
  • 24
  • 38