1

I'm working on a C++ graphics library using OpenGL. I'm on Windows, which only supports OpenGL 1.1, and I therefore have to manually load the functions from the 4.6 version. My first thought was to use GLAD, which I've used before and does all the work for you in a single function call, but that isn't the approach I want to take. I have bad habit of wanting to know how everything works internally, so I then thought of making my own loader to fit into the library. Loading the functions worked just fine, but when I got to defining the accompanying macros, I got a little stuck. Unlike the functions, where the declaration of them is stated clearly in a standard, the macros doesn't seem to have any place, where their hexadecimal values are stated. For example, how am I supposed to know what hexadecimal value GL_COLOR_BUFFER_BIT needs to have. I can look in the original OpenGL 1.1 header file, but that doesn't work with other newer macros like GL_VERTEX_SHADER.

I have searched the internet to find some standard, reference or registry, where the values of these macros may be - but with no luck. GLAD seems to have all of these values magically, but how, I don't know. Can anyone with knowledge of OpenGL please explain this and maybe provide a link. I know how OpenGL works, but I'm new to OpenGL loaders.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 2
    Are you looking for that header?: [glext.h](https://registry.khronos.org/OpenGL/api/GL/glext.h) This can be downloaded from Khronos. – Scheff's Cat May 30 '23 at 15:04
  • How you write an integer doesn't matter. Decimal 19 is the same number as hexadecimal 13 and octal 23 and Roman XIX. – molbdnilo May 30 '23 at 15:05
  • "*Loading the functions worked just fine, but when I got to defining the accompanying macros, I got a little stuck.*" Where did you get the function prototypes from? That same place will have the enumerators too. – Nicol Bolas May 30 '23 at 15:09
  • 2
    I don't know if the values for the macros are defined by the spec (don't think so), but you can look them up in the [OpenGL Registry](https://registry.khronos.org/OpenGL/index_gl.php), specifically, in the xml folder in their [github repository](https://github.com/KhronosGroup/OpenGL-Registry). – BDL May 30 '23 at 15:09

0 Answers0