PDA

View Full Version : Convert GL_TRIANGLE_STRIP data to GL_POINTS



deeps8us
05-20-2016, 04:25 AM
I have my cordinate data as follows :


private final float[] verticesData = {
// X, Y, Z, U, V
-1.0f, -1.0f, 0, 0.f, 0.f,
1.0f, -1.0f, 0, 1.f, 0.f,
-1.0f, 1.0f, 0, 0.f, 1.f,
1.0f, 1.0f, 0, 1.f, 1.f,
};

and I pass this to vertex attribute as below




GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 20, vertices);
GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 20, vertices);

GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);


For histogram purpose, I need to draw the same data as GL_POINTS instead of GL_TRIANGLE_STRIP.

How to do that?

malexander
05-20-2016, 07:52 AM
Just draw it as points:

GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 4);
That'll draw 4 points.