View Full Version : How to read the .spec files (for transformation)

09-11-2010, 02:25 AM

I'd like to read in the .spec files and use the data in them for other processing tasks, which may include generating code or just conversion to some easier to handle format like XML. Alfonse Reinheart has shown something similar in thread .spec request: XML (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=281189#Post2811 89).

Thus far I have been able to figure out how to use the type conversion maps. I also think how to read the functions belonging to certain extensions. Where I became puzzled was that how do I determine which feature is declared in which version and deprecated in which version of OpenGL? More specifically, what information I need to read and from which .spec files to connect the "contents" in different OpenGL versions and extensions and how do I determine when something is deprecated?

There are other bits of information I need to take care of, like some enums re-used etc., but I think I can manage those. As you probably can guess, I'm very new to OpenGL. Perhaps I ask something that is obvious, I don't know. Please, enlighten me. :)

Stephen A
09-11-2010, 05:40 AM
The "version" property should give you the version when a method was first introduced. For extensions, use the "category" property. For deprecated methods, check the "deprecated" property. Also note the "use" declaration for enums (reuse value or rename enum).

That's it more or less for a straightforward transformation. It is possible to do more exotic things, like generating overloads (Vertex3 instead of Vertex3[fdiv]) and using strongly-typed enums, but this can get *very* painful (the .spec files are decades old and have many inconsistencies).

I have written a C# generator for the .spec files (see http://www.opentk.com) which performs almost every transformation possible. It's open-source (MIT/X11), but the code is very convoluted and all kinds of ugly.

Feel free to ask if you have any questions on the specs!

09-14-2010, 09:47 PM
Hi, Stephen! I think you answered my questions already. I just need to check in the next few weeks -- i.e. try to write code -- if I understood it correctly. Thanks for your insight and sorry for being slow to getting back.