Using nv_texture_shader as color table

I want to render a 3D-texture (12-bit luminance) and apply a color table on the ‘result’. What I have reckoned from earlier postings is that I should use the texture_shader(2) extension.
I have tried different things without success so I wonder if someone can post (or email me) some code showing how this should be done because…
Outlines of what I have done is

  1. Create 2 textures, a HILO 3D-texture, and a luminance 1D-texture.
  2. Use the result from the 3D-texture to index in the 1D-texure

Have I missed somehing crucial??

code clip:
glEnable( GL_TEXTURE_SHADER_NV );
glGenTextures( 1, &tex );
glBindTexture( GL_TEXTURE_3D, tex);
glTexImage3D( GL_TEXTURE_3D, 0, GL_HILO_NV,
image->width(), image->height(), image->depth(), 0,
GL_HILO_NV, GL_UNSIGNED_BYTE, image->imageData() );

glGenTextures( 1, &lookup );
glBindTexture( GL_TEXTURE_1D, lookup );
glTexImage1D( GL_TEXTURE_1D, 0, GL_LUMINANCE, 4096, 0,
GL_LUMINANCE, GL_UNSIGNED_SHORT, palette_data );

// stage 0
glActiveTexture( GL_TEXTURE0_ARB );
glBindTexture( GL_TEXTURE_3D, tex );
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);

// stage 1
glActiveTexture( GL_TEXTURE1_ARB );
glBindTexture( GL_TEXTURE_1D, lookup );
glTexEnvi( GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);

[This message has been edited by johanh (edited 01-11-2002).]