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

Thread: How did you guys learn vertex programming?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Posts
    6

    How did you guys learn vertex programming?

    I'm investigating it for my final year project at university but am finding it incredibly difficult to find decent resources on it. I've seen the OpenGL 1.4 specs but I really want a tutorial.

  2. #2
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: How did you guys learn vertex programming?

    There are a finite number of vertex program asm instructions, and very simple syntax rules - so where's the problem?
    MUL a,b,c = multiply b by c and store the result in a.
    it's a doddle!
    Knackered

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2002
    Posts
    6

    Re: How did you guys learn vertex programming?

    Where do you learn these rules and instructions? I don't know any!

    Referring to your example, why would you want to multiply b by c anyway? Why not just use the standard way of multiplying (b*c)?

    [This message has been edited by Billy Lee (edited 11-18-2002).]

  4. #4
    Member Regular Contributor
    Join Date
    Jul 2002
    Location
    Austria
    Posts
    280

    Re: How did you guys learn vertex programming?

    Where do you learn these rules and instructions?
    You read the specs to the vertex shader assembly languages. Grab the ARB_vertex_program spec, read it for a couple of hours and off you go.

    Referring to your example, why would
    you want to multiply b by c anyway?
    Lol, why not? You can do lots of nice things by multiplying things together. Say b and c are colors and you want to modulate them.

    Why not just use the standard way of multiplying (b*c)?
    Because * is not a legal assembly instruction in any vertex assembly language.
    You can write (b * c) in the DX9 HLSL or in Cg, but those are high-level shading languages.

    Cheers.
    XEngine - The Platform- and API-Independent 3D Engine
    with Programmable Pipeline Support: [URL=http://xengine.sourceforge.net
    My]http://xengine.sourceforge.net

  5. #5
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: How did you guys learn vertex programming?

    http://oss.sgi.com/projects/ogl-samp...ex_program.txt
    http://oss.sgi.com/projects/ogl-samp...ex_program.txt

    The reason you can't do a=b*c is because, as has been pointed out, this is a high level way of describing the operation. Vertex programs are modelled on assembly language because they have a small number of registers, and they have to be efficient - because they operate on huge amounts of data (your vertices), and also they have a very limited maximum number of allowed instructions. Exposing the functionality as an assembly language makes sure people take care when writing them, as seemingly simple operations in a high level language can use up a huge number of assembly instructions, which will bring your rendering performance to its knees without you being fully aware as to why.
    Just think of it as programming a sinclair ZX81 - you'd have been crazy to use a high level language with that, simply because you were so limited in clock cycles that you *needed* to know *exactly* what the CPU was doing, and how long it was taking to do it.

    [This message has been edited by knackered (edited 11-18-2002).]
    Knackered

  6. #6
    Intern Contributor
    Join Date
    Oct 2002
    Posts
    54

    Re: How did you guys learn vertex programming?

    It's Direct3D, but it offers an excellent grasp of the vertex program (shader in this case) and the philosophy behind it.

    http://www.gamedev.net/columns/hardcore/dxshader1/

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

    Re: How did you guys learn vertex programming?

    developer.nvidia.com (get the SDK)

    or cvs1.nvidia.com for the individual folders.

    vertex programming is nothing complex if you know ASM languages. I think your problem will be what do do to get the effect you want.

    Here's a short explanation :
    Read from v, output to o in vs files and setup your program states in the vsp files.
    In your cpp (or c) file call the attribute functions to setup some of the contents of the registers. The c registers can be used in any way you like. The programmer must decide which register serves what purpose. There is a limit to how many instrucion you can have and how many constants.

    I have been skimming the demoes and the specs on my free time so I might be wrong.

    One more thing, the more experience and knowledge you have about the opengl pipeline, texturing tricks and general knowledge of the physics of lighting, the better. Reading about the harware capabilities is good too in the end.

    V-man
    ------------------------------
    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);

  8. #8

    Re: How did you guys learn vertex programming?

    I'm in this same boat - the vertex/fragment shader code isn't what I'm having difficulty with, it's hooking it all up. Still having problems getting simple texture mapping working. See "Texture mapping w/vertex & fragment shaders " thread.

    Scott
    Scott
    Home Theater & Road Racing Nut

Posting Permissions

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