View Full Version : glVertex3fv question
10-19-2008, 04:54 PM
Hi...I was going through nate robins smooth tutorial
Nate robins smooth tutorial (http://www.xmission.com/~nate/smooth.html)
the glmDraw function defined by him uses glVector3fv to render each polygon.Now i want to rasterize the triangles myself using a simple rasterization algorithm but i need x,y,z coordinates for that.Can anyone tell me how i can extract the x y z coordinates of vertices from the vector datastructures.
If he uses glVertex3fv, that means, that the x,y,z coordinates have to be tightly packed in an array, e.g.:
float vertex1 =
0, // x-coordinate
0, // y-coordinate
0 // z-coordinate
This could then be passed like this:
So, if you got the array with the vertex-data, simply access , and  to get x,y and z respectively.
10-19-2008, 06:32 PM
thanks for the reply...
i did what u said and i can draw the model using only glvertex3f instead of glvertex3fv...
The x y z values for one of the vertices are
can u explain why the coordinates are not integers...are they relative to the screen...
No, they are in world-space. All coordinates are given as floats, since a 3D environment is continuous, integers would only allow you to have discrete steps, which would be useless.
Try reading some book or beginners tutorials about OpenGL, many things will become clear to you then.
10-20-2008, 02:34 AM
Abhijith: ...are they relative to the screen...
you provide them in model space then they get "transformed" to eyespace with the Modelview matrix and to screen space with the ModelViewProjection matrix. this is a bit advanced if you are really new to 3d graphics. reading the OpenGL bible would help.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.