Vishwanath Deshmukh
Vishwanath Deshmukh

Reputation: 649

How to show edges with different color along with faces in different color (android)

I have drawn a cube with triangle strip and colored it. This cube is triangle_strip of 16 vertices. But now I've to show it's edges with white color. Can anyone please tell me how to achieve it. Following code snipest shows you I drawn a cube.

    vertices.put(x).put(y).put(z); //1
    vertices.put(x).put(y).put(z);//2
    ........

    vertices.put(x).put(y).put(zz);//16
     gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices);

    gl.glColorPointer(4, GL10.GL_UNSIGNED_BYTE, 0, colors);

    gl.glRotatef(angle, 0.1f, 1.0f, -0.1f); // Rotate 

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertexCount);

Upvotes: 0

Views: 2252

Answers (1)

Tim
Tim

Reputation: 35933

What you'll have to do is draw the cube, and then draw the edges of the cube again in GL_LINES mode.

To avoid issues with the depth buffer, you can use glPolygonOffset to give the lines a slight bias so they show up in front of the cube.

Upvotes: 0

Related Questions