List of OpenGL functions per version

I am starting OpenGL and I face some problems:

  1. outdated examples written for early OpenGL versions
  2. outdated code that I probably need to update
  3. C-oriented everything

I am completely lost in the specs, versions and notations that C coders use, so I’d like to start with the two questions:

  1. What is the primary (tested) source of OpenGL API for machines? PDF doesn’t work, because it requires human to process.
  2. Is there already an official list of OpenGL functions per version?

I need a simple plain list of functions in alphabetic order, maybe with parameters, so I can run a diff on them, compare and see which ones should be removed from my code to be OpenGL 4 or OpenGL 2 compliant.

The reference cards should suffice, like: http://www.khronos.org/files/opengl4-quick-reference-card.pdf

Although, OGL 2 and below are too ancient for anyone to care - the API specification is all you get.

I guess you’ve seen that I explicitly mentioned that PDF won’t work. Is everything so bad that only PDF is available? Parsing PDF is painful - it is made by humans who make mistakes. And it is very hard to track updates to this PDF (if possible at all).

This is sort of an odd-ball use, but you could use my glLoadGen tool to generate exactly that. It will generate headers/source for loaders for the specific OpenGL version you want. So you could simply copy-and-paste the header definitions out of them.

it is made by humans who make mistakes.

Yes. So are all of the other sources of OpenGL information.

There are alternatives though. My glLoadGen tool is built on top of an XML-ized version (technically a “Lua-ized” version, but same difference) of the OpenGL .spec files, which are the canonical source of this information. Which was also written by humans who make mistakes. Parsing the .spec files directly is pretty difficult, though it shouldn’t be too hard if you’re looking for specific information.

It would be easier to write an XSLT transform that looked for functions who’s version tag was less than or equal to some number. Or, again, you could just use glLoadGen to make headers and copy them out to wherever you need them.

Actually, you could use glLoadGen’s parsing system to write your own generation style, who’s sole purpose is to simply dump all of the function names for a version into a given file. It’s a bit complex (and I haven’t finished all the docs explaining everything about the process), but it’s very doable.

Thanks. The tool looks nice, but as I mentioned I don’t do C. It is at least feasible to parse these headers/sources (unlike PDF), but still a lot of unreliable magic.

By “made by humans who make mistakes” I’ve meant that fixing a mistake in machine readable document will automatically propagate the fix to all derivatives. With PDF it is not possible.

Those .spec files seem what I need. Why it is difficult to parse them? I don’t know information structure, but http://www.opengl.org/registry/api/gl.spec looks like a set of key: value pairs.

Are there any other known .spec tools (something in Python will be easier to hack)?
I don’t know the data structure - is it possible to use generic template engine for this generator? Like http://mustache.github.com/ ?

For me it seems that the best place for structured data is public MongoDB at https://mongolab.com/home with public API to access it - https://support.mongolab.com/entries/20433053-rest-api-for-mongodb and a web browser.

There is a Python-based GL API description as part of https://github.com/p3/regal, as one other alternative.
Specifically, https://github.com/p3/regal/blob/master/scripts/gl.py.

  • Nigel

Regal looks like one awesome piece of code. Is the information in gl.pygenerated automatically from gl.spec or it is manually maintained? I see that Export.py is the entrypoint into the output generation toolchain, but there is nothing about gl.spec parsing.

regal is one step further from what I am trying to do. Very professional presentation and positioning.

I try to create a simple OpenGL support diagnostic utility that will output information about the supported API and (maybe) give some recommendations how to improve it. When regal jumps directly into rendering, I want to detect known problems before they occur and warn about them.