function pointers slow?

[b][red]This message was edited by PAG at 2002-10-26 0:38:3[/red][/b][hr]
Im working on this OpenGL wrapper class, and am thinking of making function pointers to all opengl functions. Is this going to slow down the calls? I mean will it be faster to call the gl functions directly instead?

Heres some code to make it a bit more clear of what i mean:

class COpenGL

void (__stdcall *Vertex3f)(GLfloat x, GLfloat y, GLfloat z);

Vertex3f = glVertex3f;

COpenGL gl;
gl.Vertex3f(0.0f, 0.0f, 0.0f);



  • Compared to the amount of work each GL function performs, the cost of looking up the value of a class variable is minimal.

    Unless you're planning changing which GL function to call at run-time, then direct calling is the obvious thing?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion