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 2 of 2

Thread: ranges

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2010
    Posts
    111

    ranges

    hello.
    How i can adapt a range from x to y to a range from 0 to 1 in glsl?
    for example : if i have a x = -20 and a y = 200 how to fit in a 0 to 1 range?
    there is an already done function?
    thanks.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Nope there isn't. The example isn't very helpful. Normalizing values is only helpful if you have a minimum and maximum you want to push the values into so the min value maps to 0 and the max value maps to 1.

Posting Permissions

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