Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: glClearColor

  1. #1
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    glClearColor

    I want to set the background color. From Qt i get the color-rgb values from 0-255 for each. If i pass these values to glClearColor, the clors are not always the right. If i divide these values by 255 it look much better. Is this process correct, do i have to normalize the color values?
    Thanks
    juergen

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    596

    Re: glClearColor

    The clearColor function takes floats as inParameters, and those should be between 0-1 where 0=no value, and 1=max value..
    0,0,0,x = black
    1,1,1,x = white
    (x = whatever alpha you want to clear with)

    /Mikael

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,070

    Re: glClearColor

    The values of the glClearColor are between 0 and 1. And the varaible should be a float.

    example:

    glClearColor(0.0, 0.5, 1.0);

    float's 0.0, 0.25, 0.5, 0.75, 1.0;


    Originally posted by guju:
    I want to set the background color. From Qt i get the color-rgb values from 0-255 for each. If i pass these values to glClearColor, the clors are not always the right. If i divide these values by 255 it look much better. Is this process correct, do i have to normalize the color values?
    Thanks
    juergen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •