Quick question.
Is there a way to pass an int in c++ into a openGL function that is looking for a GLint??
example I am trying to pass an int to
Where faces is a vector of ints and faceLoop is an integer.Code:glVertex4iv(faces.at(faceLoop));
Quick question.
Is there a way to pass an int in c++ into a openGL function that is looking for a GLint??
example I am trying to pass an int to
Where faces is a vector of ints and faceLoop is an integer.Code:glVertex4iv(faces.at(faceLoop));
I'm pretty sure GLints and GLfloats are just typedef's for ints and floats. You can pass an int where it expect a GLint and you can pass a float where it expects a GLfloat (and so on with other OpenGL types). I could be wrong though. If just passing it doesn't work, then perhaps try casting it.Code:glVertex4iv((GLint)faces.at(faceLoop));
Last edited by SlyMaelstrom; 09-24-2006 at 08:04 PM.
Sent from my iPadŽ
If you don't have the prototype for that function (ie, the right header file) then it might not have an implicit cast.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
glVertex4iv takes an array. Lucky you, vector memory is guaranteed to be contiguous. 100% guaranteed mofckyug, you hear dat?!
Or if the 4 ints you want to pass are not at the start of the vectorCode:glVertex4iv(&faces.at(0)); glVertex4iv(&faces[0]); glVertex4iv(faces.begin());
Code:glVertex4iv(&faces.at(index)); glVertex4iv(&faces[index]); glVertex4iv(faces.begin() + index);