Results 1 to 5 of 5

Thread: color

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    2

    color

    // set to GOLD color....

    float mamb[]={0.24725f,0.1995f,0.0745f,1.0f}; //Ambient Reflection
    float mdif[]={0.75164f,0.60648f,0.22648f,1.0f}; //Diffuse Reflection
    float mspe[]={0.628281f,0.555802f,0.366065f,1.0f}; //Specular Reflection

    glMaterialfv(GL_FRONT,GL_AMBIENT,mamb); //Set material properties
    glMaterialfv(GL_FRONT,GL_DIFFUSE,mdif);
    glMaterialfv(GL_FRONT,GL_SPECULAR,mspe);


    how can i obtain the correct floating points as above in order to get my desired color?

    how can i know that they stands for gold?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    King George, Virginia
    Posts
    132

    Re: color

    the best way is to use a paint program that lets you specify colors using rgb values (ie photoshop, psp, mspaint?) the usual metric for rgb in these programs are unsigned bytes (either decimal or hex) you just have to convert it to a float.

    jebus

  3. #3
    Member Newbie
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    48

    Re: color

    Gold isn't a color you can mix by RGB values. The best way should be to create a reflective or even mirroring texture and give it a dark yellow color.
    Knowledge is Power

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    2

    Re: color

    how to convert to float?

  5. #5
    Senior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Fort Collins, Colorado
    Posts
    446

    Re: color

    RGB colors in paint programs are commonly calculated in unsigned bytes, with a range of 0-255. Therefore, you would simply divide the color value by 255 to get a float value for the color.

    For example, suppose your RGB color in Photoshop is R=127 G=255 B=53
    the float values would be:
    R=127/255=0.498 (approx 0.5)
    G=255/255=1.0
    B=53/255=0.208

    Hope that helps.

    Edit: Stoopid typos

    [This message has been edited by yakuza (edited 11-08-2002).]

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. High color/true color troubles on Win2000
    By Lelik in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-22-2004, 04:39 AM
  3. Drawing color affected by texture color
    By yossi in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-14-2001, 03:56 AM
  4. How to show object-color through light-color?
    By jonn in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-18-2001, 09:25 PM
  5. color buffer color as source for register combiners
    By Kosta in forum OpenGL: General
    Replies: 1
    Last Post: 07-11-2000, 09:47 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