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: GL_ARB[NV]_vertex_program

  1. #1
    Intern Contributor
    Join Date
    Nov 2001
    Posts
    77

    GL_ARB[NV]_vertex_program

    I'm having some problems understanding the two extensions GL_ARB_vertex_program and GL_NV_vertex_program. I understand how to set up the extensions and load programs, but I'm confused as to the format of the programs (most tutorials seem to leave that part out.) I'm guessing they have to be assembled before they're loaded, but according to nVidia's site, there's a difference between the DirectX 8+ vertex shaders and OpenGL vertex programs and...well, I'm starting to confuse myself. Can someone explain this to me, or point me to a document which explains it in pretty good detail? Thanks!

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264

    Re: GL_ARB[NV]_vertex_program

    The format? Look at the many examples you can find on the net.

    There is always a header :

    !!ARBvp1.0 or !!VP1.0

    declare options in ARB. example :
    option ARB_percision_fastest;

    Then make a few declarations of constants, attributes, output, temporaries.
    NV only requires constants because the others are predefined. In ARB, you can give them the name you desire.

    Then comes the program body :

    instruction destination, source1, source2, source3, ... ;

    and to finish ...

    END


    of course, all that should be in a single string that you upload to GL (glProgramStringARB or glLoadProgramNV)

    The documents that explain these in detail are the specifications.

    There are books like "OpenGL Extensions Guide" http://search.barnesandnoble.com/textboo...isbn=1584502940
    ------------------------------
    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
    Intern Contributor
    Join Date
    Nov 2001
    Posts
    77

    Re: GL_ARB[NV]_vertex_program

    From what I'm gathering from your post, you don't have to compile the program then? Just send it as a string? And yes, I've seen programs with that format, but I was trying to refer to the format the compiled byte code. Sorry for the confusing...very difficult topic for me to grasp. ^^

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264

    Re: GL_ARB[NV]_vertex_program

    I guess you are from a d3d background.

    No, you don't get to access bytecode. When you send the string (ASCII 8 bit), it is immediatly compiled to bytecode.

    There has been discussions about this feature beeing available. Some people want real time ultra fast compiling. If you need it, you can post a message in the suggestions forum.
    ------------------------------
    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);

Posting Permissions

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