handmade.network » Forums » Question about auto-generated opengl function loader
Chen96
Chen
18 posts
#11210 Question about auto-generated opengl function loader
2 months, 3 weeks ago

Hi folks! I want to write an Opengl function loader for my friend's game. Since I don't want to go through the pain of loading each function by hand, I want to write some kind of tool that helps me parse and generate the code that load these functions. However, I don't know where I can get a text file or an h file that has all the function declarations in them. My friend wants OpenGL 3.3 core profile API. If any of you folks know where I can get that, please tell me. Thanks a lot!

Alex
mmozeiko
Mārtiņš Možeiko
1317 posts
1 project
#11211 Question about auto-generated opengl function loader
2 months, 3 weeks ago Edited by Mārtiņš Možeiko on March 8, 2017, 7:31 a.m.

This is the official core profile header, but it includes up to latest GL 4.5 version + some extensions: https://github.com/KhronosGroup/O...ry/blob/master/api/GL/glcorearb.h

It is autogenerated from these xml files: https://github.com/KhronosGroup/OpenGL-Registry/tree/master/xml
You can parse these xml files yourself and generate only what you want (only specific version, no extensions, or something other). It includes pdf documentation describing xml format, but it is very simple.

There is glad generator that will generate only what you choose: http://glad.dav1d.de/ It will produce C header, and optionally very tiny loader that requires you to provide actual loading function.
Chen96
Chen
18 posts
#11220 Question about auto-generated opengl function loader
2 months, 3 weeks ago

Thanks a lot! This was exactly I was looking for. I wanted to reply faster but apparently handmade network was offline. And for some reason there are Chinese advertisement threads appearing in the "work-in-progress" section of the website. I doubt if it's coincidence :(

Alex