Core Profile and Compatibility Profile
The Key Versions to Revolute The OpenGL
- OpenGL 3.0 introduced deprecation model to gradually remove legacy functions.
- OpenGL 3.1 removed the deprecated functions and the remaining part forms the Core Profile.
- OpenGL 3.2 introduced Compatibility Profile to maintain backwards compatibility.
Core Profile OpenGL
- Have access to later OpenGL functionalities
- More suitable for modern GPU
- Many familiar functionalities removed
- All rendering must use shaders
- A shader is a program loaded and executed in a stage of the rendering pipeline
- The shader is a user program which means that the users have to/can define their own shaders to realize the rendering
OpenGL Pipeline
A simplified view of OpenGL Graphics Pipeline is shown as follows:
Vertex Shading
- Excuted per vertex
- Produces vertex NDC (normalized device coordinates) coordinates
Tesssllation
- Tessellation Control Shader (TCS)
- Executed per patch vertex
- Receives patch vertices (control points) from vertex shader
- Generates tessellation output patch vertices to pass to the Tessellation Evaluation Shader (TES)
- Specifies tessellation level factors
- Optional
- Tessellation Primitive Generator (TPG)
- Receives tessellation level factors from TCS
- Performs tessellation and generates tessellation coordinates for the resulting primitives and pass them to the Tessellation Evaluation Shader (TES)
- not programmable
- Tessellation Evaluation Shader (TES)
- Executed per tessellation coordinate
- Receives patch vertices (control points) from TCS
- Computes vertex position from tessellation coordinate
- Optional
Geometry Shading
- Executed per primitive
- Receives complete primitive (as arrays of vertices/attributes) from earlier stage
- Outputs zero primitive (culling) or more primitives (geometry amplification)
- Can output primitive type different from input
- Optional
Primitive Assembly, etc.
This part is fixed, cannot be programmed
- Primitive assembly
- Vertex data is collected into complete primitives
- Necessary for clipping and back-face culling
- Clipping
- Perspective division
- To normalized device coordinate (NDC) space
- Viewport transformation
- To windows space
- Include depth range scaling
- Back-face culling
Rasterization
- If geometric primitive is not clipped out, the appropriate pixels in the frame buffer must be assigned colors
- Rasterizer produces a set of framgements for each primitive
- Fragments are “potential pixels”, they have pixel/fragment locations (in window space) and have color and depth attributes (and others)
Fragment Shading
- Executed per fragment
- Each generated fragment is processed to determine the color of the corresponding pixel in the framebuffer
Per-Fragment Operations
After fragment shading, each resulting fragment is submitted to a set of simple operations before reaching the framebuffer
Framebuffer
A framebuffer (frame buffer or framestore) is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing a complete frame of data.
Modern OpenGL
OpenGL 4.5
- Khronos OpenGL Registry
- OpenGL Wiki
- OpenGL 4.5 Reference Pages
- OpenGL 4.5 API Reference Card
Some OpenGL Libraries
GLUT (OpenGL Utility Toolkit)
- Too Old
FreeGLUT
- Based on GLUT API
- Open source
- Many tutorials and examples out there use GLUT/freeGLUT
- Fully compatible with GLUT
- More bugs sometimes
http://freeglut.sourceforge.net/
GLEW (OpenGL Extension Wrangler)
- Cross platform
- Open source
- C/C++ extension loading library
GLM (OpenGL Mathematics)
- A header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications
https://glm.g-truc.net/0.9.9/index.html
GLFW
- Open source
- Multi platform
- Provides a simple API for creating windows, contexts and surface, receiving input and events.
- Similar to GLUT/FreeGLUT
Modern OpenGL
User can design their own shaders in modern OpenGL.
Please indicate the source of the reference. This article will be updated permanently:https://blogs.littlegenius.xin/2020/01/19/OpenGL-1/