I have drawn cubes using OpenGL. Now, I have to show only the edges of that cube. It should look like a cube cage. How can I do this?
My code look likes as follows:
// Each element is a triangle strip of 16 vertices.
vertices.put(x).put(y).put(zz);
vertices.put(x).put(y).put(zz);
vertices.put(xx).put(y).put(zz);
vertices.put(x).put(yy).put(zz);
vertices.put(xx).put(yy).put(zz);
vertices.put(xx).put(yy).put(z);
vertices.put(xx).put(y).put(zz);
vertices.put(xx).put(y).put(z);
vertices.put(x).put(y).put(z);
vertices.put(xx).put(yy).put(z);
vertices.put(x).put(yy).put(z);
vertices.put(x).put(yy).put(zz);
vertices.put(x).put(y).put(z);
vertices.put(x).put(y).put(zz);
vertices.put(xx).put(y).put(zz);
vertices.put(xx).put(y).put(zz);
int color = Color.GRAY;
for ( int j = 0; j < 16; ++j )
{
colors.put(color);
}
vertices.position(0);
colors.position(0);
You will have to draw the lines defining the edges of the cube with the
GL_LINESprimitive.