NV_texture_shader and dot products

If texture 0 is an 2D texture with unsigned RGB data, will a GL_DOT_PRODUCT_NV shader operation work ? I’m trying to use 3 dot products for a dependent 3D texture lookup by using (1,0,0), (0,1,0) and (0,0,1) as the texture coordinates to the dot product stages. The idea is simply to use (R,G,B) texels from the 2D texture as the texture coordinates for the 3D texture.

For debugging I created a 3D texture containing the function f(r,g,b)=(R,G,B). So the texture shader shouldn’t visibly alter the colors. The result is, however, not as expected. Is it absolutely neccessary to use a signed internal format for the 2D texture in the first stage ?

[This message has been edited by PH (edited 12-05-2002).]


I’m using this technique (with standard unsigned byte RGB textures) for color correction. Have no problem with this.

– Niels

[This message has been edited by Niels Husted Kjaer (edited 12-06-2002).]

Thanks, so it should work. I must have a bug somewhere else then.

Simply ignoring the dot products and using the result from stage 0 ( rather than stage 3 ) gives the wrong results. The image is too dark but should be identicle. Also, just setting up stage 0 with GL_TEXTURE_2D as the shader operation and GL_NONE for the other stages, the result is correct.

[This message has been edited by PH (edited 12-06-2002).]

Why don’t you simply use the GL_DEPENDENT_RGB_TEXTURE_3D_NV texture shader operation?

Well, I am using that on the GeForce4TI. This is not available on GeForce3’s.

Anyway, I found and fixed the bug. The problem was that I use pbuffers to create the 2D texture and had messed up the contexts/states. I was trying to be smart and put things in display lists and share those .