dependent textures

I’m currently trying to port someone’s GL code from using NV specific extensions to ARB ones. The code uses texture shading and register combiners which I believe are supported by ARB (via ARB_texture_env_combine). I’m somewhat new to fragment shading and don’t know all that’s going on in the code. Basically, I’m trying to retrieve green-blue values from a texture (dependent texturing) and I can’t seem to figure out how I might do this with the ABR extensions.

My snippet of code looks like:
glActiveTextureARB(GL_TEXTURE2_ARB);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, this->greenBlue_tex);

this->greenBlue_tex is 256x256 array that holds RGB values (with R=0). I’m basically trying to do color correction.

Does anyone have any input?

Thanks!
-Dave

<bump>

Anyone know how to do this using ATI_fragment_shader? I have the same problem (needing to go a green-blue dependent texture read).

Thanks,

Fuzzy.

Originally posted by werh37:
[b]I’m currently trying to port someone’s GL code from using NV specific extensions to ARB ones. The code uses texture shading and register combiners which I believe are supported by ARB (via ARB_texture_env_combine). I’m somewhat new to fragment shading and don’t know all that’s going on in the code. Basically, I’m trying to retrieve green-blue values from a texture (dependent texturing) and I can’t seem to figure out how I might do this with the ABR extensions.

My snippet of code looks like:
glActiveTextureARB(GL_TEXTURE2_ARB);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, this->greenBlue_tex);

this->greenBlue_tex is 256x256 array that holds RGB values (with R=0). I’m basically trying to do color correction.

Does anyone have any input?

Thanks!
-Dave[/b]

To do dependant texture lookups you cannot use ARB_texture_env_combine. You will have to use ARB_fragement_program.

As for the actual code you need here is some psudo code (I am too lazy to look up the exact syntax)

//Do initial texture lookup
TEX R0,texcoords ,texture[0], 2D

//Do dependant texture lookup
TEX R0, R0.gb, texture[1], 2D

As for ATI fragment shader, I have actually done this tex op (but once again, too lazy to lookup so here is some psudo code)

//Initial texture lookup
tex r0, t0

//move the gb coordinats
mov r1.r, r0.g
mov r1.gb, r0.b

//Do dependant texture lookup
// This will be a second “phase” op.
// (r1 as texture coordinates)
tex r1, r1