Rainbow color band and color palettes in OpenGL?

Show 40 post(s) from this thread on one page
Page 2 of 2 First 12
• 10-25-2012, 03:35 AM
Dan Bartlett
You should be providing coordinates between 0.0 and 1.0. How you map the values you have (-500 to 3346) to this range is up to you.
If you want to map your range in an increasing linear fashion (lowest value = 0.0, highest value = 1.0, linear mapping between), you could use:

Code :

```//TexCoord = (Value -(-500))/(3346-(-500)); TexCoord = (Value + 500)/(500+3346)```
You could either do this before you pass values into the shaders, or within the shader.
• 01-15-2013, 12:57 AM
rakeshthp
Quote:

Originally Posted by Dan Bartlett
You should be providing coordinates between 0.0 and 1.0. How you map the values you have (-500 to 3346) to this range is up to you.
If you want to map your range in an increasing linear fashion (lowest value = 0.0, highest value = 1.0, linear mapping between), you could use:

Code :

```//TexCoord = (Value -(-500))/(3346-(-500)); TexCoord = (Value + 500)/(500+3346)```
You could either do this before you pass values into the shaders, or within the shader.

Which one would be the good approach? Mapping values before they are passed into shaders? or within the shaders itself? I feel doing it within the shader is easy.

Thanks
Show 40 post(s) from this thread on one page
Page 2 of 2 First 12