PDA

View Full Version : glVertex3fv to glVertex3f

jono_123
11-22-2002, 10:53 PM
hi
this example i got off the net draws 3d meshes and the drawing bit goes:

glBegin(GL_TRIANGLES);
for (int k = 0;k < (mesh.nIndices);k++) {
index = mesh.indices[k];
glNormal3fv(&mesh.normals[index*3]);
glVertex3fv(&mesh.coordinates[index*3]);
}
glEnd();
now instead of glVertex3fv i need to use glVertex3f so what would the 3 floats be?

if it helps to know some of the values here is some of the mesh.indices:
mesh01_indices[] = {
0, 2, 1,
0, 3, 2,
4, 6, 5,
4, 7, 6,
8, 10, 9,
8, 11, 10, ...etc...

and mesh.coordinates
mesh01_coords[] = {
10.921, -13.726, -9.72222,
14.132, -7.6249, -9.86111,
6.762, -5.2301, -9.9156,
1.8675, -7.7234, -9.87954,
10.921, -13.726, -9.72222,
1.8675, -7.7234, -9.87954,
-3.5106, -11.079, -9.8193, ...etc...
thanks

[This message has been edited by jono_123 (edited 11-23-2002).]

kehziah
11-23-2002, 12:01 AM
that would be

glBegin(GL_TRIANGLES);
for (int k = 0;k < (mesh.nIndices);k++) {
index = mesh.indices[k];
glNormal3f(mesh.normals[index*3], mesh.normals[index*3+1], mesh.normals[index*3+2]);
glVertex3f(mesh.coordinates[index*3], mesh.coordinates[index*3+1], mesh.coordinates[index*3+2]);
}
glEnd();

jono_123
11-23-2002, 12:16 PM
thanks very much that works perfectly
but how did you know to do that
could you please explain to me how these work?