Advertisement

how to convert from short to const short*

Started by May 20, 2001 08:34 AM
2 comments, last by forteq 23 years, 8 months ago
error C2664: ''glVertex3sv'' : cannot convert parameter 1 from ''short'' to ''const short *'' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast The problem is that I''ve got a struct with indices stored for the drawing of the triangles. But when I want to draw them the above error occurs. How can I convert a ''short'' to a ''const short *''? maybe this is helpfull for you to answer my question //the triangle structure struct LH3D_Triangle { short indices[3]; }; //here is how i draw the triangle //pGeo->mpTriangles is a pointer to the Triangle structure for(int indices=0;indices<3;indices++) { glVertex3sv(pGeo->mpTriangles->indices[indices]); } Rob
Try this
.
.
.
for(int indices=0;indices<3;indices++)
{
glVertex3sv(&(pGeo->mpTriangles->indices[indices]));
}
Advertisement
Thanks it worked
glVertex3sv takes an array of three shorts but you''re trying to give it one short at a time three times. You should use either of these:

glVertex3s( // 3s, not 3sv
pGeo->mpTriangles->indices[0],
pGeo->mpTriangles->indices[1],
pGeo->mpTriangles->indices[2]);

** or **

glVertex3sv(pGeo->mpTriangles->indices);

Either way you don''t need a for loop.

-Mike

-Mike

This topic is closed to new replies.

Advertisement