In OpenGL, everything is in 3D space, but the screen is a 2D pixel array. The process of transforming 3D coordinates to 2D pixels is managed by the Graphics Pipeline.
The Pipeline Flow
Before we draw, we must understand how data travels from our C++ code to the GPU.
Vertex Input
To start drawing, we first have to give OpenGL some input vertex data. OpenGL is a 3D graphics library, so all coordinates are in 3D (x, y, and z).
// Triangle vertices
float vertices[] = {
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f
};
float vertices[] = {
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f
};
