PDA

View Full Version : NEWBIE: What lines of code do I need for setting up ARB_vertex_program?



JONSKI
10-20-2002, 09:05 AM
This is my first post on the board.

Anyways, I have the Det 40's installed and all that good stuff, but let's say I'm using NeHe's lesson2 code and I want to make my own ARB_vertex_program. What code would I need to add? I searched the board and couldn't find what I was looking for, and I also can't seem to find any examples anywhere on the 'net.

jwatte
10-20-2002, 09:55 AM
You need to use glGetString() to get the extensions string to test that the extension is supported.

Then you need to use wglGetProcAddress() (or glx, or whatever your platform is) to get the extension functions as defined in the extension registry.

You need to Enable() on VERTEX_PROGRAM_ARB.

You need to use GenProgramsARB() to generate program Ids (much like texture Ids), BindProgramARB() to bind a program, ProgramStringARB() to actually send your program to the system (much like TexImage). You do this on the VERTEX_PROGRAM_ARB target.

Use GetString() on PROGRAM_ERROR_STRING_ARB to get the error message if ProgramStringARB() failed.

You need to set up any parameters your program may need with ProgramEnvParameterARB() and ProgramLocalParameterARB().

You need to feed vertex data to the program with VertexAttrib*ARB() (or the array version).

For more details, see the document at http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_vertex_program.txt (or in the extension registry, or on ATIs web site; same thing)

MichaelK
10-21-2002, 02:50 AM
Is there any difference between GL_NV_vertex_program and GL_ARB_vertex_program or they have only different names?

And what about GL_EXT_vertex_program (or sth like that)?

Asgard
10-21-2002, 03:28 AM
There are quite a lot of differences and they are definitly not compatible. Check out the specs in the extension registry: http://oss.sgi.com/projects/ogl-sample/registry/

JONSKI
10-21-2002, 08:11 PM
Originally posted by jwatte:
You need to use glGetString() to get the extensions string to test that the extension is supported.

Then you need to use wglGetProcAddress() (or glx, or whatever your platform is) to get the extension functions as defined in the extension registry.

You need to Enable() on VERTEX_PROGRAM_ARB.

You need to use GenProgramsARB() to generate program Ids (much like texture Ids), BindProgramARB() to bind a program, ProgramStringARB() to actually send your program to the system (much like TexImage). You do this on the VERTEX_PROGRAM_ARB target.

Use GetString() on PROGRAM_ERROR_STRING_ARB to get the error message if ProgramStringARB() failed.

You need to set up any parameters your program may need with ProgramEnvParameterARB() and ProgramLocalParameterARB().

You need to feed vertex data to the program with VertexAttrib*ARB() (or the array version).

For more details, see the document at http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_vertex_program.txt (or in the extension registry, or on ATIs web site; same thing)Cool, thanks. That link is some pretty heavy reading, but I should get through it soon.

Cab
10-22-2002, 02:00 AM
Originally posted by MichaelK:
Is there any difference between GL_NV_vertex_program and GL_ARB_vertex_program or they have only different names?

And what about GL_EXT_vertex_program (or sth like that)?

You can see the differences in detail with those two extensions in the ARB_vertex_program spec.


[This message has been edited by Cab (edited 10-22-2002).]