Wednesday 15 August 2012

c - what is a declaration(?) like "GLenum GlewInitResult = glewInit();" doing? -


I hope you do not mind readers to answer my simple request. GLNM gluinitorsil = Gravinut ();

I have to make sure that I understand this right.

Is the GLenum GlewInitResult setting the same?

And is GlewInitResult being assigned only to return value of glewInit ()?

Or to ask, whats

  difference between GLenum GlewInitResult = glewInit ();   

and

  GLenum GlewInitResult = glewInit; // This statement gives me a type of mismatch error   

What is the bracket doing in an announcement (?)?

Sorry if this is a minor question, I just want to make sure that I understand / understand the overall concept of OpenGL programming with freight.

declares it as a variable called GlewInitResult and calls the function GlewInit specifies in the variable.

You can see it as two steps:

  1. Announce the variable
  2. Assign the function call to the variable

    Just like

      GLenum GlewInitResult; GlewInitResult = glewInit ();   

    This is too basic stuff, and should be in the first chapter of any C (or C ++) book. There is no anything to do this with the OpenGL or GLEW library.

    For your second question, stores the first call function glewInit and the results given in the variable. Attempts to store the pointer function in the second variable, and as the variable is declared incorrectly, you get an error.

No comments:

Post a Comment