Difference between setting up opengl c++ project, writing rendering code with GLAD for opengl 3.3+ and opengl 2.1

71 Views Asked by At

I want to setup OpenGL project with using 2.1 version in VS 2019. I know that there is the latest version 4.6 but i have laptop which doesn't support versions later than 2.1. I use GLFW and GLAD libraries and i have the next question:

  1. Is there any difference between setting up GLAD, writing rendering code (vertex attributes, buffers, glDrawElements, shader programs, uniform variables) for OpenGL 2.1 and 3.3+? And is there any limitations in OpenGL 2.1 functionality?

I want to make sure I can use 2.1 version the same way as 3.3+ for drawing 3d models:

  1. Create and vertex buffer, vertex attributes and element buffer
  2. Setup vertex attributes
  3. Compile vertex and fragment shaders and link them into shader program
  4. Use my shader in drawing 3d objects
  5. Bind all buffers before drawing and unbind them after drawing
  6. Draw 3d objects with glDrawElements
1

There are 1 best solutions below

1
o_oTurtle On

OpenGL has hugely changed since version 3.0. The most significant one is that since 3.2, the immediate mode has been deprecated and the core profile is the only used mode. There are also many new features, e.g. geometry shaders, sRGB, instanced rendering, etc.

VBO is available in 2.1, but OpenGL wiki shows that VAO, which is widely used in OpenGL 3.3+, is added in 3.0, so possibly you cannot code like this.