Howdy, Stranger!

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

Categories

function pointers slow?

PAGPAG Member Posts: 168
[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:

[code]
class COpenGL
{
public:
COpenGL();

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

COpenGL::COpenGL()
{
Vertex3f = glVertex3f;
}

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

[/code]






Comments

  • SteveCSteveC Member Posts: 63
    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?

  • Shawn CarterShawn Carter Member Posts: 0

    _____ // http://forcoder.org // free ebooks and video tutorials about | PHP, C++, R, C#, Python, Delphi, Ruby, JavaScript, Java, C, MATLAB, Swift, Assembly, Perl, Scratch, PL/SQL, Visual Basic .NET, Objective-C, Go, Visual Basic Alice, Scheme, Dart, Lisp, Bash, Apex, D, Prolog, Scala, Lua, COBOL, LabVIEW, Erlang, ML, Logo, Crystal, Julia, Hack, Clojure, Awk, Fortran, FoxPro, VBScript, Kotlin, Rust, Transact-SQL, F#, Ada, ABAP, SAS | ___________

Sign In or Register to comment.