PDA

View Full Version : ARB vp question



raverbach
03-31-2004, 11:53 AM
Hello everybody !

After working with Cg shaders, I started playing with vp 1.0.
Would anyone please give me a link to any ARB vp syntax document ?

Or anwser me this : I want to pass a sine wave value to a vertex program, i can do this one way:
multiplying original vertex coordinates by the sine value in the main code, and then send this value with glVertex to set vertex.position.

But I want to pass this sine wave value as a program variable and keep my original vertex coordinates and then multiply them in the VP.
How can i do that ?

I tried glProgramEnvParameter4fARB, but my geometry simply disapear ...

Thanks in advance ...... !

Jens Scheddin
03-31-2004, 12:18 PM
Originally posted by raverbach:
Hello everybody !

After working with Cg shaders, I started playing with vp 1.0.
Would anyone please give me a link to any ARB vp syntax document ?

Or anwser me this : I want to pass a sine wave value to a vertex program, i can do this one way:
multiplying original vertex coordinates by the sine value in the main code, and then send this value with glVertex to set vertex.position.

But I want to pass this sine wave value as a program variable and keep my original vertex coordinates and then multiply them in the VP.
How can i do that ?

I tried glProgramEnvParameter4fARB, but my geometry simply disapear ...

Thanks in advance ...... !First: You can find the extension spec, like for every other public extension, at OpenGL Extension Registry (http://oss.sgi.com/projects/ogl-sample/registry/) . It's a very good (== complex) description of the extension.

Second: You should change your point of view regarding vertex programs. They let you do whatever you want with the variables you input. Variables input with glVertex*() don't neccessarily need to be vertex positions. They could also be color, normal or something else. But be carefull with glColor*(), because colors (normals too?) are normalized into the range 0.0-1.0. Vertex programs are just like "fetch some variables -> do something with these values --> output the result".

Hope this helps

SeskaPeel
03-31-2004, 11:25 PM
You canf ind out a good tutorial on nvidia website : http://developer.nvidia.com/object/GDC_2003_Presentations.html

Look for "OpenGL ARB_vertex_program" files.

SeskaPeel.