How can I create a VBO of a type determined at runtime?

Posted by lapin on Game Development See other posts from Game Development or by lapin
Published on 2012-09-24T14:37:42Z Indexed on 2012/09/24 21:50 UTC
Read the original article Hit count: 220

Filed under:

I've written a Vbo template class to work with OpenGL.

I'd like to set the type from a config file at runtime. For example:

<vbo type="bump_vt" ... />

Vbo* pVbo = new Vbo(bump_vt, ...);

Is there some way I can do this without a large if-else block such as:

if( sType.compareTo("bump_vt") == 0 )
    Vbo* pVbo = new Vbo(bump_vt, ...);
else if
    ...

I'm writing for multiple platforms in C++.

© Game Development or respective owner

Related posts about c++