Results 1 to 5 of 5

Thread: color maps in OpenGL

  1. #1
    Guest

    color maps in OpenGL

    Hi,
    I had asked earlier this month about animation in OpenGL and the animation that I produced is in grayscale. The problem seems to be that I don't have RGB values for the images just single integers from 0 to 255 that I put into the RGB array. I thought of using color-index mapping but I'm at a loss on how to generate a lookup table. Is it that OpenGL has its own internal lookup table or I can specify mine. If I could specify my own color map, how do I implement this ( I am thinking of using the glIndex function).


    Thanks

  2. #2
    Member Contributor
    Join Date
    Apr 2002
    Location
    Spain
    Posts
    63

    Re: color maps in OpenGL

    If you use indexed colour, you will loose hardware acceleration. To achieve the grayscale effect in higher colour modes as 16 or 32 bit, do this:

    I suppose your color maps work like this: 0 is black and 255 is white. Then you must enter the three RGB values as

    ((float)i/255,(float)i/255,(float)i/255))

    in OpenGL functions.

    where "i" is the index of your colour.

    [This message has been edited by Azdo (edited 04-27-2002).]

  3. #3
    Guest

    Re: color maps in OpenGL

    Hi,
    Thanks for your reply but I have a different problem. I have an image which can be expressed as a 296x128 pixel array. This represents a density map and there is only one value of the density per pixel( so to speak). Please see the topic in this forum 'Animation using OpenGL' by Otonski.
    My solution was to give the same density value to the RGB array ie red = 255, green = 255, blue = 255. That produced the grayscale image( notice they are integers). I thought using a color map where a number say 202 generates an RGB triplet may be the solution to making a color image.


    Thanks

  4. #4
    Member Contributor
    Join Date
    Apr 2002
    Location
    Spain
    Posts
    63

    Re: color maps in OpenGL

    Originally posted by Otonski:
    Please see the topic in this forum 'Animation using OpenGL' by Otonski.
    So you are saying that you don't want a monochrome image but a colormap which holds the "density" of the image. I think this can't be done easily from the image. You must preprocess your data, then use it with OpenGL

  5. #5
    Member Contributor
    Join Date
    Apr 2002
    Location
    Spain
    Posts
    63

    Re: color maps in OpenGL

    Originally posted by Azdo:
    You must preprocess your data, then use it with OpenGL
    You can, for example, set the range of all your values between 0 and 0x00FFFFFF by dividing all your values by 255, then multiplying them by 0x00FFFFFF. The purpose is to have the RGB values of the colour. If red and green values are zero, then use only the blue value:

    if (color&0xFFFF00==0) color=color&0xFF;

    The same with the green and red values.

    If I find a better algorithm, I'll let you know.

Similar Threads

  1. Rainbow color band and color palettes in OpenGL?
    By rakeshthp in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 01-15-2013, 01:57 AM
  2. Rendering Aspect Maps(Slope Maps)
    By Mukund in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-22-2011, 11:17 AM
  3. Shadow maps without border color
    By LaBasX2 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 04-12-2009, 06:21 AM
  4. Density Maps in OpenGl
    By Clayton in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-21-2003, 03:13 PM
  5. Color maps in Open Inventor ASCII file format
    By aras in forum OpenGL: General
    Replies: 0
    Last Post: 07-05-2001, 09:22 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