I want to draw a 10 by 10 grid that defines the plane of the earth so that the center is the source of the worldβs coordinates. This is the code that is called for each row defined in the grid.
gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVerticesBuffer); gl.glTranslatef(x, y, z); gl.glRotatef(rz, 0, 0, 1); gl.glRotatef(rx, 1, 0, 0); gl.glRotatef(ry, 0, 1, 0); gl.glDrawArrays(GL10.GL_LINES, 0, 2); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
The problem is that I see only one horizontal line. Therefore, I think something is wrong.
This is the code that defines the lines:
Line line; for (int i = 0; i <= 10; i++) { // horizontal lines line = new Line(-50, 0, 0, 50, 0, 0, 0, 0, 1, 1); // blue line line.z = (i * 100) - 50; lines.add(line); // draw perspective lines line = new Line(-50, 0, 0, 50, 0, 0, 0, 0, 1, 1); // blue line line.x = (i * 100) - 50; line.ry = 90; lines.add(line); }
For each row in the row collection, I call the drawing code in onDrawFrame.