Homogeneous Representation (cont)
n
to go from ordinary to homogeneous coordinates
u
if the object is a point, append a 1
u
if the object is a vector, append a 0
n
to go from homogeneous to ordinary coordinates
u
if the object is a point, delete the 1
✦
this rule will change later on
u
if the object is a vector, delete the 0
Points in OpenGL
n
OpenGL represents a point with a set of floating-point numbers
called a vertex
n
to draw a group of points use
GLfloat x0, y0, z0, x1, y1, z1, xn, yn, zn;
// assign values to x0, y0, z0, etc. here
// .
..
glBegin(GL_POINTS);
glVertex3f(x0, y0, z0);
// point with coordinates (x0, y0, z0)
glVertex3f(x1, y1, z1);
// and so on…
glVertex3f(xn, yn, zn);
glEnd();
n
every call to glVertex() sends a vertex down the geometry stage