texgen with ARB_vertex_program

Has anybody used the texgen option of ARB_vertex_program? I have projection working the way I want using the fixed pipeline in eye space, but I can’t seem to get the texgen planes to hold anything other than the default values. s is always 1,0,0,0, t is 0,1,0,0 and r&q are 0,0,0,0. I use PARAM texgenPlaneS = state.texgen.eye.s; to get the plane.

What can I be doing wrong if it works in the fixed function pipeline?

ARB_vertex_program, and all other vertex programming extensions, don’t use any fixed-function T&L. This includes texgens. You will have to emulate them in your VP.

Originally posted by Korval:
ARB_vertex_program, and all other vertex programming extensions, don’t use any fixed-function T&L. This includes texgens. You will have to emulate them in your VP.

Are you sure? I thought I could multiply my vertex position by the modelview matrix to get it into eye space and then multiply it by the “texgen matrix” created by the four planes.

If I can’t do this then what is point of state.texgen[n].eye/object.s/t/r/q if they just hold the default OpenGL values?

All Korval was trying to say is that you have to write the vertex program code to do the texgen yourself – nothing is done automatically, but you obviously already know this.

You really should have access to the texgen planes. Are you sure you’re accessing the right texture unit? Did you actually specify the eye planes correctly? Did you perhaps forget to take the texture matrix into account?

– Tom

Korval,

From the ARB_vertex_program spec:

If a program parameter binding matches a set of TexGen plane coefficients,
    the "x", "y", "z", and "w" components of the program parameter variable
    are filled with the coefficients p1, p2, p3, and p4, respectively, for
    object linear coefficients, and the coefficents p1', p2', p3', and p4',
    respectively, for eye linear coefficients (section 2.10.4).

In section 2.10.4 of the OpenGL 1.4 spec, it clearly says that the coefficients (p1’ p2’ p3’ p4’) = (p1 p2 p3 p4)M-1. p1…p4 are the planes set with glTexGen, p1’…p4’ are the planes transformed by the inverse modelview matrix.

So if what Titan is saying is ture, that he’s getting a default values, I’d say the driver had issues. Or the ARB_vertex_program spec is wrong.

Originally posted by Tom Nuydens:
Did you actually specify the eye planes correctly?-- Tom

Nope. I screwed up. I changed my code, skipping setting the planes to what I needed them to be, a bit for testing and forgot I did that. Should’ve been obvious when they held the default values, but I was sure my code was being executed until I put a break point in it today…

Appologies to those who helped.