Register combiner question

Hi,

I am trying to implement Cass Everitt’s “Order independent transparency” paper, but without using the ‘nvparse’ library. This means that I’m suppose to create a simple register combiner program using the OGL-NV api.

The simple RC program is: (pasted from the layerz.cpp code from NVidia)

out.rgb = col0
out.a = tex3.b

And this is what I think it should be:

// out.rgb = col0
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

// out.a = tex3.b
glFinalCombinerInputNV(GL_VARIABLE_G_NV, GL_TEXTURE3, GL_UNSIGNED_INVERT_NV, GL_BLUE);
glEnable(GL_REGISTER_COMBINERS_NV);

I say ‘think’ because I can’t get my implementation to work, and I suspect it is because of an error in the register combiner setup.

Have I done it right or wrong? I have read the RC-doc from NVIDIA, but Im still not sure if I have done it correctly.

Are you using glGetError ?

Originally posted by Zengar:
Are you using glGetError ?

Yes I do. I have plenty of errorchecking to catch gl-errors. The program is running fine, but I dont thing it does what it is suppose to do :slight_smile:

Why GL_UNSIGNED_INVERT_NV and not GL_UNSIGNED_IDENTITY_NV for the G ouput?

kon

Originally posted by kon:
Why GL_UNSIGNED_INVERT_NV and not GL_UNSIGNED_IDENTITY_NV for the G ouput?

Good point, but changing it doesn’t solve the problem quite yet.
One of my main questions is whether using glFinalCombinerInput is the right way. Should it be done using glGeneralCombinerInput instead? I am after all setting glCombinerParameter to 1 (setting to 0 leads to an GL error). Will this uninitilized general combiner stage affect the result?

As I remember, yes you do need at least 1 general combiner set up to pass info to the final combiner. NVPARSE inserts a blank general combiner automatically if one is not specified in the script.