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 4 of 4

Thread: Glvertexpointer Buffer

  1. #1
    Newbie Newbie
    Join Date
    Jul 2012
    Posts
    3

    Glvertexpointer Buffer

    Hai

    Let's get straight to the point, the last arguement in glvertexpointer is the coord of the first vertex of the model
    the coord is located in a buffer, how will i access that buffer and retrieve that coord?

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    If you are using VBO, then you can map the buffer with glMapBuffer.
    If you aren't using VBO, then call glGetPointerv :

    float *pointer;
    glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer);
    x=pointer[0];
    y=pointer[1];
    z=pointer[2];
    etc.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    964
    If you want to read back from a VBO to system memory then you're going to incur substantial performance penalties due to pipeline stalls. Maybe you better say what it is that you're trying to accomplish as there will likely be much better options available.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    Quote Originally Posted by Crownable View Post
    how will i access that buffer and retrieve that coord?
    On the GPU in a shader? Or on the CPU? Your question is a bit vague.

    Also, do you have a particular version of OpenGL you're targetting? E.g. 4.2 core, 3.3 compatibility, 2.1, etc?

Posting Permissions

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