I am trying to render a two-dimensional half-plane in OpenGL with the following code:
void renderHalfplane(double *x, double *n)
{
glPushMatrix();
double theta = -360.0 * atan2(n[0], n[1])/(2.0*PI);
glTranslated(x[0], x[1], 0);
glRotated(theta, 0, 0, 1.0);
glBegin(GL_TRIANGLES);
glVertex4d(0.0, 0.0, 0.0, 1.0);
glVertex4d(1.0, 0.0, 0.0, 0.0);
glVertex4d(0.0,-1.0, 0.0, 0.0);
glVertex4d(0.0, 0.0, 0.0, 1,0);
glVertex4d(-1.0,0.0, 0.0, 0.0);
glVertex4d(0.0,-1.0, 0.0, 0.0);
glEnd();
glPopMatrix();
}
Here I'm using homogeneous coordinates to draw triangles with two vertices at "infinity."
This code works like a charm on my computer, but a user is reporting that it doesn't render correctly on theirs: instead of an infinite half-plane they are seeing two (finite) triangles.
Is my use of w-coordinate 0 undefined behavior? Is it something that only works on some versions of OpenGL? I tried looking through the Khronos OpenGL specs but couldn't find a section where rendering of primitives with w-coordinate 0 was addressed.