What level of expertise in C++ do I need to have in order to learn OpenGL?

You don't need to be a master in C++ to start learning OpenGL. As a matter of fact, you don't even need to know C++. If you know a decent amount of C, you should be fine to start working with OpenGL.

OpenGL is not a programming language, it is an API. An API is a software intermediary that makes it possible for different programs to interact with each other. In the case of OpenGL, it allows the interaction between the CPU and the GPU. In other words, with the OpenGL API, you can transmit data from the CPU to the GPU and vice-versa.

Think of OpenGL as a client-side and a server-side.

Client Side

The client-side deals with loading data onto OpenGL buffers and then transferring them to the GPU. In order to send data to the GPU, you must create and bind what is known as OpenGL Objects. OpenGL Objects are structures composed of states and data and are responsible for transmitting data to and from the GPU.

There are several types of OpenGL Objects. For example, a Vertex Buffer Object can store vertices of a character. Whereas a Texture, another kind of OpenGL Object, can store image data.

The client-side is where you use the OpenGL API extensively. For example, you can create an OpenGL Object by calling the following API call:

//Name of buffer object 
GLuint bufferName; 

//Create an OpenGL object of BUFFER type 
glGenBuffers(1, &bufferName); 

//Bind a OpenGL Buffer Object to the context
glBindBuffer(GL_ARRAY_BUFFER, bufferName);

In the same manner, to load data to the GPU you can call the following method:

glBufferData(GL_ARRAY_BUFFER,sizeof(data), data, GL_STATIC_DRAW);

Server Side

The server-side consists of shaders. A shader is a small program developed by you that lives in the GPU. A shader is written in a special graphics language called OpenGL Shading Language (GLSL).

The GLSL is based on the ā€œCā€ programming language. As any other programming language, GLSL contains data types such as int, float, bool. It can handle loops and conditional statements like for-loops, while-loops and if-else statements. What makes it different from any other language is that it contains data types especifically designed to handle 3D mathematics. e.g., vec2, vec3, mat2, mat3.

So, do you need to be an expert in C++ or in any other language to start working with OpenGL? No, not at all. If you know a decent amount of programming, you should be fine.

Harold Serrano

Computer Graphics Enthusiast. Currently developing a 3D Game Engine.