Results 1 to 5 of 5

Thread: Using nv_texture_shader as color table

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Stockholm, Sweden
    Posts
    6

    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);

  2. #2
    Member Contributor
    Join Date
    Jun 2001
    Location
    Denmark
    Posts
    82

    Re: Using nv_texture_shader as color table

    Hi,

    How do you obtain the shader result? You should setup the register combiners to get this for you.

    You should also download your HILO texture wit GL_UNSIGNED_SHORT as type.

    -- Niels

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Stockholm, Sweden
    Posts
    6

    Re: Using nv_texture_shader as color table

    OK. I was not aware of that, and I have not done anything with the register combiners... Do you have any tips on what needs to be done?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Sep 2000
    Location
    Santa Clara, CA
    Posts
    1,096

    Re: Using nv_texture_shader as color table

    You need to use a Nx1 2D texture rather than a 1D texture, and use the DOT_PRODUCT_TEXTURE_2D operation.

    - Matt

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Stockholm, Sweden
    Posts
    6

    Re: Using nv_texture_shader as color table

    I think I start to understand how the register combiners are supposed to work, but I don't understand how to use them in this context .
    Can someone post some code that shows how to set up the texture shader and register combiner (and corresponding textures) to make it work. I have a 16 (or 12bit) luminance 3Dtexture and want to use another texture as a lookup table. I just cant get things right!

    .Johan

Similar Threads

  1. Color Lookup Table questions..
    By robertmonaghan in forum OpenGL: GLSL
    Replies: 7
    Last Post: 08-08-2011, 01:57 PM
  2. Color table problems
    By TBOY in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-14-2004, 06:58 PM
  3. gl Color Table Extension
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-14-2003, 08:58 AM
  4. Using nv_texture_shader as color table
    By johanh in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-11-2002, 07:11 AM
  5. Texture Color Table - Correct setup?
    By plg in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-20-2000, 11:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean