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!

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

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. ^^

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.