Vertex Program: Simulating OpenGL !

Hi there…

I have started playing with vertex programs under Win2K (using Detonator 10.40) and I must say that it seems quite funky !

I have a question though: by enabling the vertex programs, you override the whole T&L part of the GPU (I know, this is the purpose !).

Now, how can I simulate this T&L part with vertex programs ?

I mean, I know how to calculate HPOS,TEX0-7, … but I have no idea how to calculate COL0, when I have lighting enable.

Say I just do:

glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
RenderObject();

How do I compute the lighting in my vertex program so that the result is the same as not using the program ??? (i.e. GL_LIGHT0 has default parameters… I can post them if needed…).

I had a look at nVidia’s examples (especially the “simple specular and diffuse lighting with an eye-space normal”) but I do not think it is what I want to do: they use a half-angle vector (?) which never appears when using OpenGL (or does it ?).

Thanks to anyone who can help me on this one (and to the others as well ! ) !

Best Regards !

Eric

P.S.: isn’t there a way to put comments in the vertex program string ??? Each time I try the “#” as stated in the specs, nvoglnt.dll crashes !!!

Lo Eric.

To compute the lighting, typically do something like a dot product with a light vector and the vertex normal (parallel light) or for point light source simply make a vector to the light source from the vertex, and use that vector with the vertex normal.

Then just multiply the value you got with the incoming color, and store in outgoing color… or somat like that…

As for lighting properties… I’m not too sure on that at the mo… typically I just load the position into a C register for us in the program.

Mail me this detonator 10 driver please. ta.

I get crashes with comments in 7.17 too… bit annoying… cos I keep losing track of which instructions are doing what… (they all look the same… )

Eric,

We should have the NVIDIA OpenGL SDK out today, and it has some examples of rolling your own lighting with vertex programs.

Thanks -
Cass

Originally posted by cass:
We should have the NVIDIA OpenGL SDK out today

What can I say ???

YEEEEEEEEPPPPPPPPEEEEEEEEEEEEEEEEEEEEEE !

Regards.

Eric

How can I get the Detonator 10.4

JK: As NVidia states on the page of the OpenGL SDK: if you are are NVidia registered developer you can get the Detonator 10.4 drivers from the registered developers driver section of their website.

Bjoern