Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Convert GL_TRIANGLE_STRIP data to GL_POINTS

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2016
    Posts
    12

    Convert GL_TRIANGLE_STRIP data to GL_POINTS

    I have my cordinate data as follows :

    Code :
    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



    Code :
    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?

  2. #2
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    369
    Just draw it as points:
    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 4);
    That'll draw 4 points.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •