Skip to content
Search

OpenGL

lastmod 2025-05-14created 2014-02-0391 edits

Subfields of OpenGL

OpenGL 3.3 Reference

  • glActiveTexture
  • glAttachShader
  • glBeginConditionalRender
  • glBeginQuery
  • glBeginTransformFeedback
  • glBindAttribLocation
  • glBindBuffer
  • glBindBufferBase
  • glBindBufferRange
  • glBindFragDataLocation
  • glBindFragDataLocationIndexed
  • glBindFramebuffer
  • glBindRenderbuffer
  • glBindSampler
  • glBindTexture
  • glBindVertexArray
  • glBlendColor
  • glBlendEquation
  • glBlendEquationSeparate
  • glBlendFunc
  • glBlendFuncSeparate
  • glBlitFramebuffer
  • glBufferData
  • glBufferSubData
  • glCheckFramebufferStatus
  • glClampColor
  • glClear
  • glClearBuffer
  • glClearColor
  • glClearDepth
  • glClearStencil
  • glClientWaitSync
  • glColorMask
  • glCompileShader
  • glCompressedTexImage1D
  • glCompressedTexImage2D
  • glCompressedTexImage3D
  • glCompressedTexSubImage1D
  • glCompressedTexSubImage2D
  • glCompressedTexSubImage3D
  • glCopyBufferSubData
  • glCopyTexImage1D
  • glCopyTexImage2D
  • glCopyTexSubImage1D
  • glCopyTexSubImage2D
  • glCopyTexSubImage3D
  • glCreateProgram
  • glCreateShader
  • glCullFace
  • glDeleteBuffers
  • glDeleteFramebuffers
  • glDeleteProgram
  • glDeleteQueries
  • glDeleteRenderbuffers
  • glDeleteSamplers
  • glDeleteShader
  • glDeleteSync
  • glDeleteTextures
  • glDeleteVertexArrays
  • glDepthFunc
  • glDepthMask
  • glDepthRange
  • glDetachShader
  • glDisable
  • glDisableVertexAttribArray
  • glDisablei
  • glDrawArrays
  • glDrawArraysInstanced
  • glDrawBuffer
  • glDrawBuffers
  • glDrawElements
  • glDrawElementsBaseVertex
  • glDrawElementsInstanced
  • glDrawElementsInstancedBaseVertex
  • glDrawRangeElements
  • glDrawRangeElementsBaseVertex
  • glEnable
  • glEnableVertexAttribArray
  • glEndConditionalRender
  • glEndQuery
  • glEndTransformFeedback
  • glFenceSync
  • glFinish
  • glFlush
  • glFlushMappedBufferRange
  • glFramebufferRenderbuffer
  • glFramebufferTexture
  • glFramebufferTextureLayer
  • glFrontFace
  • glGenBuffers
  • glGenFramebuffers
  • glGenQueries
  • glGenRenderbuffers
  • glGenSamplers
  • glGenTextures
  • glGenVertexArrays
  • glGenerateMipmap
  • glGet
  • glGetActiveAttrib
  • glGetActiveUniform
  • glGetActiveUniformBlock
  • glGetActiveUniformBlockName
  • glGetActiveUniformName
  • glGetActiveUniformsiv
  • glGetAttachedShaders
  • glGetAttribLocation
  • glGetBufferParameter
  • glGetBufferPointerv
  • glGetBufferSubData
  • glGetCompressedTexImage
  • glGetError
  • glGetFragDataIndex
  • glGetFragDataLocation
  • glGetFramebufferAttachmentParameter
  • glGetMultisample
  • glGetProgram
  • glGetProgramInfoLog
  • glGetQueryObject
  • glGetQueryiv
  • glGetRenderbufferParameter
  • glGetSamplerParameter
  • glGetShader
  • glGetShaderInfoLog
  • glGetShaderSource
  • glGetString
  • glGetSync
  • glGetTexImage
  • glGetTexLevelParameter
  • glGetTexParameter
  • glGetTransformFeedbackVarying
  • glGetUniform
  • glGetUniformBlockIndex
  • glGetUniformIndices
  • glGetUniformLocation
  • glGetVertexAttrib
  • glGetVertexAttribPointerv
  • glHint
  • glIsBuffer
  • glIsEnabled
  • glIsFramebuffer
  • glIsProgram
  • glIsQuery
  • glIsRenderbuffer
  • glIsSampler
  • glIsShader
  • glIsSync
  • glIsTexture
  • glIsVertexArray
  • glLineWidth
  • glLinkProgram
  • glLogicOp
  • glMapBuffer
  • glMapBufferRange
  • glMultiDrawArrays
  • glMultiDrawElements
  • glMultiDrawElementsBaseVertex
  • glPixelStore
  • glPointParameter
  • glPointSize
  • glPolygonMode
  • glPolygonOffset
  • glPrimitiveRestartIndex
  • glProvokingVertex
  • glQueryCounter
  • glReadBuffer
  • glReadPixels
  • glRenderbufferStorage
  • glRenderbufferStorageMultisample
  • glSampleCoverage
  • glSampleMaski
  • glSamplerParameter
  • glScissor
  • glShaderSource
  • glStencilFunc
  • glStencilFuncSeparate
  • glStencilMask
  • glStencilMaskSeparate
  • glStencilOp
  • glStencilOpSeparate
  • glTexBuffer
  • glTexImage1D
  • glTexImage2D
  • glTexImage2DMultisample
  • glTexImage3D
  • glTexImage3DMultisample
  • glTexParameter
  • glTexSubImage1D
  • glTexSubImage2D
  • glTexSubImage3D
  • glTransformFeedbackVaryings
  • glUniform
  • glUniformBlockBinding
  • glUnmapBuffer
  • glUseProgram
  • glValidateProgram
  • glVertexAttrib
  • glVertexAttribDivisor
  • glVertexAttribPointer
  • glViewport
  • glWaitSync

OpenGL (Open Graphics Library) is a standard API specification for 2D and 3D graphics created by Silicon Graphics in 1992, supporting cross-language, cross-platform application programming. Using about 250 function calls, the API can generate anything from simple geometric shapes to complex three-dimensional scenes.

OpenGL is currently used in fields such as CAD, virtual reality, information visualization, and flight simulation. It is also widely used in computer games, and together with Microsoft's Direct3D it divides the world of computer graphics in two. Unlike Direct3D, the standard is shaped by discussion and proposals among many related companies, so version updates tend to be slow. Representative games developed with OpenGL are id Software's Quake and Doom 3 series. It is currently managed by the Khronos Group, a non-profit technology consortium.

OpenGL Reference Guide

OpenGL Object

Rendering pipeline

OpenGL Shading Language

  • Buffer Objects
    • Vertex Buffer Objects
    • Uniform Buffer Objects
    • Shader Storage Buffer Objects
    • Pixel Buffer Objects
    • Atomic Counters
    • Buffer Object Streaming
  • Vertex Array Objects
  • Textures
    • Texture Storage
    • Image formats
    • Sampler Objects
    • Cubemap Textures
    • Array Textures
    • Multisample Textures
    • Rectangle Textures
    • 3D Textures
    • Buffer Textures
    • Texture Views
  • Asynchronous query objects
  • Framebuffer Objects
    • Default Framebuffer
    • Renderbuffer Objects
  • Unconventional objects:
    • Sync Objects
    • Shader and program objects
  • Vertex Specification
    • Vertex Rendering
    • Primitive
  • Vertex Processing
    • Vertex Shader
    • Tessellation
    • Geometry Shader
  • Vertex Post-Processing
    • Transform Feedback
  • Primitive Assembly
    • Face Culling
  • Rasterization
  • Fragment Shader
  • Per-Sample Processing
    • Depth Test
    • Blending
  • The core language
  • Shader compilation
    • Introspection
  • Variable types
    • Type qualifiers
    • Layout qualifiers
    • Uniform variables
    • Sampler variables
  • Built-in variables
  • Interface blocks
  • Shader stages:
    • Vertex Shader
    • Tessellation
    • Geometry Shader
    • Fragment Shader
    • Compute Shader
  • Other shading languages

Quick Reference Cards

The OpenGL 4.3 Quick Reference Guide (including GLSL 4.30)
http://www.khronos.org/files/opengl43-quick-reference-card.pdf
Opengl43-quick-reference-card.pdf
The OpenGL 4.2 Quick Reference Guide (including GLSL 4.20)
http://www.khronos.org/files/opengl42-quick-reference-card.pdf
Opengl42-quick-reference-card.pdf
The OpenGL 3.2 Quick Reference Guide (including GLSL 1.50)
http://www.khronos.org/files/opengl-quick-reference-card.pdf
Opengl32-quick-reference-card.pdf

Brief description of functions by category

Describes the list of OpenGL functions and what they do.

WGL

  • wglCreateContext(): Creates a rendering context.
  • wglDeleteContext(): Deletes a rendering context.
  • wglMakeCurrent(): Sets the current rendering context.
  • wglGetProcAddress(): Returns an extension function pointer.
  • wglUseFontBitmap(): Creates OpenGL display lists for the currently selected GDI font.
  • wgluseFontOutlines(): Creates display lists for something like the current outline font.

GLUT

  • glutTimerFunc(): Calls the specified function once after the specified time. To call it again, call the function again

Pixel format

  • ChoosePIxelFormat(): Determines the closest matching pixel format.
  • SetPixelFormat(): Sets the pixel format on the device context.

Display settings

  • ChangeDisplaySetting(): Switches to full screen.
  • SwapBuffer(): Swaps the back buffer with the front buffer
  • glClear(): Clears the screen and buffers.
  • glClearColor(): Sets the screen background color.

Drawing

  • glBegin(): Starts drawing primitives.
  • glEnd(): Finishes drawing primitives.
  • glVertex[2,3,4][d,f,i,s]v: Specifies a vertex.
  • glColor[3,4]b,d,f,i,s,f: Specifies a color.

Points

  • glPointSize(): Changes the point size.

Lines

  • glLineWidth(): Changes the line width.
  • glLineStipple(): Sets the dashed-line pattern.

Polygons

  • glPolygonMode(): Sets how front and back polygons are drawn (points, lines, filled faces).
  • glCullFac(): Culls faces.
  • glFrontFace(): Changes which side is the front face.
  • glEdgeFlag(): Hides edges. Used while specifying vertices.
  • glPolygonStipple(): Sets the polygon pattern

Drawing other shapes

  • glRectf(): Draws a rectangle.
  • auxSolidCube(): Draws a cube.
  • auxSolidShpere(): Draws a sphere.
  • auxSolidTorus(): Draws a torus.

Querying state

  • glGetString(): Gets the OpenGL version and the list of extensions.
  • glGetBooleanv(): Gets state of type GLboolean.
  • glGetDoublev(): Gets state of type GLdouble.
  • glGetFloatv(): State of type GLfloat
  • glGetIntegerv(): State of type GLint
  • glEnable(): Enables a capability.
  • glDisable(): Disables a capability.

Matrices

  • glMatrixMode(): Sets the current matrix.
  • glLoadIdentity(): Makes the current matrix the identity matrix.
  • glLoadMatrixf,d: Loads the specified matrix onto the top of the matrix stack.
  • glMultMatrixf,d: Multiplies the current matrix by the specified matrix.

Stack

  • glPushAttrib(): Temporarily saves the current settings.
  • glPopAttrib(): Restores the previous settings.

Viewing transformation

  • gluLookAt(): Sets the camera position and direction.

Modeling transformation

  • glRotatef,d: Sets orientation.
  • glTranslatef,d: Sets position.
  • glScalef,d: Scales up or down.

Projection

  • glOrtho(): Orthographic projection with a specified range
  • gluOrth2D: Orthographic projection with a range of -1 ~ 1
  • glFrustum(): Asymmetric frustum perspective projection
  • gluPerspective(): Perspective projection
  • glViewport(): Sets the viewport.

Shading

  • glshadeModel(): Sets the shading model.

Lighting

  • glMaterialf,i,fv,iv: Sets surface material.
  • glLightf,i,fv,iv: Sets light sources.
  • glColorMaterial(): Color tracking. Makes the color specified with glColor be set as a material property.
  • glLightModelf,i,fv,iv: Sets the lighting model.
  • glNormal3b,d,f,i,s: Sets a normalized normal vector.

Blending

  • glBlendFunc(): Sets blending between source and destination

Depth

  • glDepthMask(): Sets the depth buffer mode (read-only, write).

Bitmaps

  • glRasterPos[2,3,4]s,i,f,d: Sets the position where a bitmap or image will be drawn. Draws from the bottom-left.
  • glBitmap(): Draws a bitmap.
  • glDrawPixels(): Draws a pixmap.
  • glReadPixels(): Reads pixels.
  • glCopyPixes(): Copies screen data.
  • glPixelZoom(): Scales up, scales down, or flips an image.
  • glPixelStorei(): Sets the pixel storage mode.
  • auxDIBImageLoad(): Loads a DIB image.
  • AUX_RGBImageRec: Struct that stores image data loaded with auxDIBImageLoad

Textures

Summary of texture-related functions

  • glGenTextures: Generates texture names.
  • glDeleteTexture: delete named textures.
  • glBindTexture: Binds a texture name to texture data.
  • glTexSubImage2D: specify a two-dimensional texture subimage.
  • glTexParameter (f,i,fv,iv): Sets the texture filtering mode.
  • glTexEnvi: Sets how texture colors relate to existing pixel colors when a texture is applied.
  • glTexImage2D: Loads a 2D image into memory as a texture.
  • glTexImage1D: Loads a 1D image into memory as a texture.
  • glTexCoord2 (f,fv): Sets texture coordinates.
  • gluBuild2DMipmaps: Generates mipmaps automatically.
  • glTexGen (d,f,i,v,fv,iv): Generates texture coordinates automatically.
  • glTexParameteri: OpenGL BMP texture loading.

Multitexturing

  • PFNGLMULTITEXCOORD2FARBPROC: glMultiTexCoord2fARB Specifies text coordinates for multitexturing. (Used by obtaining the function pointer)
  • PFNGLACTIVETEXTUREARBPROC: glActiveTextureARB Sets the texture unit. (Used by obtaining the function pointer)
  • PFNGLCLIENTACTIVETEXTUREARBPROC: glClientActiveTextureARB Activates the texture unit for vertex arrays. (Used by obtaining the function pointer)

Display lists

  • glGenLists(): Creates the specified number of display lists
  • glIsList(): Checks whether a list name is valid.
  • glNewList(): Starts recording commands into a display list.
  • glEndList(): Stops recording commands into a display list.
  • glCallList(): Executes a display list.
  • glCallLists(): Executes multiple display lists.
  • glListName(): Executes commands starting from the specified position.
  • glDeleteLists(): Frees display lists.
  • glListBase()

Vertex arrays

  • glEnableClientState(): Enables vertex arrays.
  • glDisableClientState(): Disables vertex arrays.
  • glColorPointer(): Uses a color array
  • glEdgeFlagPointer(): Specifies an array of edge flags.
  • glIndexPointer(): Specifies an array of color indices in palette mode.
  • glNormalPointer(): Specifies an array of normal vectors for each vertex.
  • glTexCoordPointer(): Specifies an array of texture coordinates for each vertex.
  • glVertexPointer(): Specifies an array of vertex position coordinates.
  • glDrawArrays(): Draws the specified primitive using each vertex of the currently enabled arrays in order.
  • glDrawElements(): Draws primitives using an index array to use arbitrary elements in arbitrary order.
  • glDrawRangeElements(): Draws primitives using only a specific range of the index array.
  • glArrayElement(): Uses only one specific element of the vertex array.
  • PFNGLLOCKARRAYSEXTPROC: glLockArraysEXT Locks arrays. (Used by obtaining the function pointer.)
  • PFNGLUNLOCKARRAYSEXTPROC: glUnlockArraysEXT Unlocks arrays. (Used by obtaining the function pointer.)

Version history

  • 1.1: Texture objects
  • 1.2: 3D textures, BGRA and packed pixel formats
  • 1.3: Multitexturing, multisampling, texture compression
  • 1.4: Depth textures
  • 1.5: Vertex buffer objects (VBO), Occlusion Queries
  • 2.0: GLSL 1.1, MRT, non-power-of-two textures, point sprites, stencil
  • 2.1: GLSL 1.2, pixel buffer objects (PBO), sRGB textures
  • 3.0: GLSL 1.3, texture arrays, conditional rendering, framebuffer objects (FBO)
  • 3.1: GLSL 1.4, Instancing, texture buffer objects, uniform buffer objects, Primitive restart
  • 3.2: GLSL 1.5, geometry shaders, multisampled textures
  • 3.3: GLSL Backports as much functionality possible from the OpenGL specification
  • 4.0: GLSL 4.00, tessellation on the GPU, shaders with 64-bit precision

OpenGL 3D computer graphics course

PART 01. Principles of 3D computer graphics

  • Chapter 01. OpenGL and Modeling: Chapter_01_-_OpenGL,_Modeling.pdf
  • Chapter 02. Callback Programming: Chapter_02_-_Callback_Programming.pdf
  • Chapter 03. Model transformation and viewing transformation: Chapter_03_-_Transformation,_Camera.pdf
  • Chapter 04. Projection and Viewport transformation: Chapter_04_-_Projection,_Viewport.pdf
  • Chapter 05. Lighting and Shading: Chapter_05_-_Lighting,_Shading.pdf
  • Chapter 06. Texture Mapping: Chapter_06_-_Texture_Mapping.pdf

PART 02. Applications of 3D computer graphics

  • Chapter 07. Shadow: Chapter_07_-_Shadow.pdf
  • Chapter 08. Particle Systems: Chapter_08_-_Particle_Systems.pdf
  • Chapter 09. Useful features: Chapter_09_-_Utility.pdf
  • Chapter 10. Motion Animation: Chapter_10_-_Motion_Animatioin.pdf

PART 03. Advanced theory and extensions

  • Chapter 11. Curves and Surfaces: Chapter_11_-_Curves,_Surfaces.pdf
  • Chapter 12. OpenGL and GUI: Chapter_12_-_OpenGL_GUI.pdf

Coordinates system

Coordinates_system_-_OpenGL_and_DirectX.png

Select a graphic device

NVidia provided an extension called WGL_nv_gpu_affinity. I'm not sure if this is still available and whether it works as you would like.

GLUT

GLUT was originally written by Mark Kilgard to support the sample programs in the second edition OpenGL 'RedBook'. Since then, GLUT has been used in a wide variety of practical applications because it is simple, widely available and highly portable.

Download
http://www.opengl.org/resources/libraries/glut/glut_downloads.php

FreeGLUT

freeglut is an open source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboard and joystick functions. freeglut is intended to be a full replacement for GLUT, and has only a few differences.

Since GLUT has gone into stagnation, freeglut is in development to improve the toolkit. It is released under the X Consortium license.

Downloading Man Page Sources

The Docbook XML source for the man pages is available for anonymous checkout in Khronos' Subversion server, and you can build a man page distribution of your own using open source tools. See the OpenGL.org technical Wiki pages describing the XML Toolchain and Man Pages for more information.

Troubleshooting

Not found libGL.so

On Ubuntu, the following error message may appear.

gcc: error: /usr/lib/x86_64-linux-gnu/libGL.so: No such file or directory

In this case, install the package as follows.

sudo apt-get install libgl1-mesa-dev

See also

Libraries

Favorite site

Guide

Tutorial

Tutorial: C/SDL OpenGL

Multithreaded Rendering on OpenGL

References


  1. Opengl32-quick-reference-card.pdf ↩

  2. Soenlab_com.7z - See the explanation of OpenGL space transformations on the soenlab.com/lecture/library/opengl/opengl-8.htm page ↩

  3. NVISION08-8MP_HDR.pdf ↩

  4. 3D_Graphics_with_OpenGL_-_The_Basic_Theory.pdf ↩

  5. Fragment shader compile success: Sdl2-opengl-sample.zip ↩

  6. Drawing_polylines_by_tessellation.pdf ↩

  7. Www_glprogramming_com_red.zip ↩

  8. Code download: https://code.google.com/p/opengl-tutorial-org/ ↩

  9. Nehe.gamedev.net.zip ↩

  10. Soenlab_com.7z ↩

  11. Modern_OpenGL_Guide.pdf ↩

author Zer0 sitemap