Reputation: 307
I'm hoping you readers wont mind answering my simple request here.
GLenum GlewInitResult = glewInit();
I want to make sure I'm understanding this right.
Is GLenum setting GlewInitResult as a a uint?
And is GlewInitResult being assigned to only the return value of glewInit()?
Or to further ask, whats the difference between
GLenum GlewInitResult = glewInit();
and
GLenum GlewInitResult = glewInit; //this statement gives me a type mismatch error
What does removing the parenthesis do in a declaration(?) like this?
Sorry if this is trivial question. I just want to make sure I'm grasping/understanding the overall concept of opengl programming with freeglut.
Upvotes: 0
Views: 201
Reputation: 409472
It declares a variable named GlewInitResult
and assigns the result of the function call glewInit
to the variable.
You can see it as two steps:
I.e. the same as
GLenum GlewInitResult;
GlewInitResult = glewInit();
This is very basic stuff, and should have been in the very first chapter of any C (or C++) book. It has nothing to do with OpenGL or the GLEW library.
As for your second question, the first calls the function glewInit
and stores the returned result in the variable. The second tries to store a pointer to the function in the variable, and as the variable is declared of the wrong type you get an error.
Upvotes: 4