Color Interpolation

Started by awesomelemonade, November 27, 2015, 22:09:41

Previous topic - Next topic

awesomelemonade

Hi, I have a simple question: Why aren't my colors interpolating? (gradient)

I've been trying to solve this all day, and even wrote a bare-bone code, and it still doesn't work.

Here is the relevant code: http://hastebin.com/bebicizata.avrasm
Shaders: http://hastebin.com/exaledifoz.avrasm

Result: http://imgur.com/DVTlRQI
What I want: a gradient between the colors of red, green, and blue.


Thanks in advanced,
Lemon

Kai

If you look closely at the rendered image especially at the edges of the triangle you see that it does interpolate.
It's just that your color values are far outside the range of valid values [0..1]. You use 255 as the largest value.
Everything above 1.0 (which is the max value of a color component) will be clamped to 1.0.
A value of 255, as seen in many libraries/APIs, is only necessary when storing colors using integral numeric type, such as byte or int, as opposed to a floating-point type as used by OpenGL.

awesomelemonade

I knew I was doing something dumb xD


Thanks :)