gl.glBegin(GL.GL_TRIANGLES);
{
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINES);
...
Very few GL commands are valid inside a glBegin()/glEnd()
block:
Only a subset of GL commands can be used between glBegin and glEnd. The commands are glVertex, glColor, glSecondaryColor, glIndex, glNormal, glFogCoord, glTexCoord, glMultiTexCoord, glVertexAttrib, glEvalCoord, glEvalPoint, glArrayElement, glMaterial, and glEdgeFlag. Also, it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd, the error flag is set and the command is ignored.
glEnable()
and glPolygonMode()
are not on that list.
Move them outside your glBegin()
block.
gl.glVertex3f(v1.x - xMiddle, v1.y - yMiddle, v1.z - zMiddle);
gl.glNormal3f(n1.x, n1.y, n1.z);
Wrong way around. You want normal, then vertex:
gl.glNormal3f(n1.x, n1.y, n1.z);
gl.glVertex3f(v1.x - xMiddle, v1.y - yMiddle, v1.z - zMiddle);
glNormal()
only sets the current normal, glVertex()
is what actually sends that down the pipeline.