View Full Version : Convert string "GL_SRC_ALPHA" to GLvar at runtime

03-03-2009, 02:41 AM
I am sure this is trivial so sorry for the noise, but I can't seem to see an obvious way to do it..

Let's say I have a configuration file with text in it such as 'GL_SRC_ALPHA' and I want to read that string and then lookup it's value as far as OpenGL is concerned so I can plug it's numeric value into the relevant OpenGL command..

Is there a command like glGetProc or glGetString that will give me the value?

03-03-2009, 03:21 AM
No, you need to generate such a lookup table yourself. You could generate it by parsing certain header-files, but i think that's overkill.

Simply use an stl map, where you write your key/value pairs into, for later lookup. I need to do the same thing for material configuration files (blending mode etc.) and it is really only about 20 to 30 values, that you really need, so not that much work.


03-03-2009, 03:50 AM
OK. Thanks for that.. Just trying to save myself re-inventing the wheel, but as you say it's only a few things you need to type out..