OpenGL Programming - Wikibooks, Open Books For An Open World
OpenGL Programming - Wikibooks, Open Books For An Open World
Welcome to the OpenGL Programming book. OpenGL is an API used for drawing 3D graphics.
OpenGL is not a programming language; an OpenGL application is typically written in C or C++.
What OpenGL does allow you to do is draw attractive, realistic 3D graphics with minimal effort. The
API is typically used to interact with a GPU, to achieve hardware-accelerated rendering.
You are free, and encouraged, to share and contribute to this wikibook: it is written in the spirit of free documentation,
that belongs to humanity. Feel free to make copies, teach it in school or professional classes, improve the text, write
comments or even new sections.
We're looking for contributors. If you know about OpenGL, feel free to leave comments, expand TODO sections and
write new ones!
Contents
Introduction
Setting Up OpenGL
Modern OpenGL
The basics arc
The lighting arc
The scientific arc
Selected topics
The post-processing arc
Mini-portal
Glescraft
Using the accumulation buffer
Cutting-edge OpenGL
Code quality
Appendices
Legacy OpenGL 1.x
Starting Tutorial
Basics
Intermediate
Advanced
Appendices
External links
Wikibooks
Ports
Freely-licensed documentation and samples
Non-freely-licensed documentation
Websites
Further reading
Introduction
1. About this book
2. History and Evolution of OpenGL
Setting Up OpenGL
Installation on GNU/Linux
Installation on Macintosh
Installation on Windows with Code::Blocks
Installation for Android NDK development
with a GLUT-like wrapper to follow the exercises
Installation for iPhone development
Installing GLUT
Modern OpenGL
"Modern" OpenGL is about OpenGL 2.1+, OpenGL ES 2.0+ and WebGL, with a programmable pipeline and shaders.
Tutorial 01:
Tutorial 02: adding more
newcomer's
01 02 robustness to our code,
introduction, first dive
transparency
into shaders
Navigation: navigate in
OBJ format: loading
3D space and
07 Suzanne the monkey 08
manipulate objects in our
from Blender
model viewer
Layers of Textures:
05 about
multitexturing
This series of tutorials is a C++ port of the GLSL wikibook tutorials about Textures in 3D.
Projectors: about
projective texture
05
mapping for
projectors
There are more tutorials to port at the GLSL wikibook!
Selected topics
Particle systems:
Anti-Aliasing:
11 12 differents kinds of particle
smoothing lines
systems
Mini-portal
This series shows how to implement a teleportation system similar to Valve's Portal, step-by-step, using OpenGL.
Mini-Portal Smooth:
Mini-Portal: a first
smooth transition,
01 working see-through 02
understanding the
portal
camera
Mini-Portal Recursive:
recursive portals - Mini-Portal Optimization:
03 04
display portals within optimization with scissors
portals
Glescraft
This series shows how to render a voxel based world, similar to Minecraft.
Glescraft 2: removing
Glescraft 1: basic voxel
01 02 unnecessary voxel
rendering
faces
Glescraft 3: texturing,
Glescraft 4: first person
03 lighting, fog, 04
camera controls
transparency
Glescraft 7: using
07
geometry shaders
Cutting-edge OpenGL
If you do not target old mobile devices or the web, you can upgrade to OpenGL (ES) 3.x / 4.x. It notably introduces
new kinds of shaders: Geometry, Tessellation Control and Tessellation Evaluation, and Compute.
Code quality
Appendices
OpenGL ES 2.0 Overview: OpenGL ES 2.0 (OpenGL for Embedded Systems 2.0) concepts and its
differences to normal OpenGL
Migrating from 1.x to 2.x: how to upgrade your code to use modern OpenGL
Glossary: what do all those new weird words mean?
APIs, Libraries and acronyms: how all acronyms relate to each others
OpenGL Shading Language: elements of GLSL programming
Shaders reference: input and output variables list
Team: contributors to this wikibook
Download code: wikibooks-opengl code repository (https://gitlab.com/wikibooks-opengl/modern-tutorials)
Starting Tutorial
1. Setting Up A Programming Environment On Windows
2. Setting Up OpenGL In The Programming Environment
3. Drawing Primitives
1. Immediate Mode
2. Display Lists
3. Vertex Arrays
4. Basic Transformations
1. Translation
2. Rotation
3. Scaling
4. Custom Transformations
Basics
1. Structure of a Typical OpenGL Application
2. Drawing Rectangles
3. Drawing Lines and Points
4. Drawing Simple 2D Shapes
5. OpenGL Naming Conventions
6. Using Color
7. Viewing Transformations
8. Drawing Simple 3D Objects
9. Perspective versus Orthographic Projections
Intermediate
1. Smoothing Polygons with Normals
2. Adding Lights
3. Using Materials
4. Using Textures
5. Using Mipmaps
6. Drawing Complex Polygons Using Tessellation
Advanced
1. Optimizing OpenGL Code
2. Drawing Shadows
3. Drawing Using Quadrics
4. Drawing Using NURBS and Curves
5. Ambient Occlusion
Appendices
1. Coordinate Transformations
2. Understanding Transformation Matrices
3. OpenGL Library Reference. functions and type reference for gl.h glu.h and glut.h
4. Why OpenGL Exists and What It's Good For
5. Migrating from 1.x to 2.x: how to upgrade your code to use modern OpenGL
External links
Wikibooks
Related WikiBooks:
GLSL Programming : wikibook on the use of the OpenGL Shading Language (GLSL) in Unity 3 and
Blender 2.5, with much information on lighting and texturing
Blender 3D: Noob to Pro: comprehensive book on using the Blender 3D modeling environment
an open source, cross-platform IDE's for exploring pixel based graphics on the GPU using GLSL :
Fragmentarium
Shadertoy
Ports
The following websites provide conversion of the tutorials to other programming languages or platforms:
Non-freely-licensed documentation
NeHe's OpenGL tutorial (http://nehe.gamedev.net/lesson.asp?index=01): OpenGL 1.x
Collection of OpenGL fundamentals tutorials using C++ and Windows API (http://www.falloutsoftware.co
m/): OpenGL 1.x
ZeusCMD OpenGL Tutorials (http://www.zeuscmd.com/): OpenGL 1.x
OpenGL Programming Examples (https://tutorialsplay.com/opengl/): OpenGL 1.x,
Websites
OpenGL Lighting Model Tutorial with Examples (http://www.falloutsoftware.com/tutorials/gl/gl8.htm)
Official OpenGL Website (http://opengl.org/)
Mesa, an open-sourced 3D graphics library almost identical to OpenGL (http://mesa3d.org/)
Further reading
OpenGL Architecture Review Board, et al: OpenGL Programming Guide: The Official Guide to Learning
OpenGL, Version 2, Fifth Edition, Addison-Wesley, ISBN 0-321-33573-2
OpenGL Architecture Review Board, et al: OpenGL Reference Manual: The Official Reference Document
to OpenGL, Version 1.4, Addison-Wesley, ISBN 0-321-17383-X
Wright, Richard S. Jr and Lipchak, Benjamin: OpenGL SuperBible, Third Edition, Sams Publishing, ISBN
0-672-32601-9
< OpenGL Programming
- Comment on this page
- Recent stats (http://stats.grok.se/en.b/
latest90/OpenGL_Programming)
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you
agree to the Terms of Use and Privacy Policy.