Help❓ Why is this code not working?

Posts 1–4 of 4 · Page 1 of 1
why would anyone do 255/255 instead of putting actual float values there is beyond me ._.
You are dividing any number by 255, without appending .f, which means you are dividing an int by an int, not a float by a float. Integers cant hold decimal fractions, which means that the division will either be 0 or 1, nothing inbetween, which is what you want. Divide a float by a float instead. ( 150.f / 255.f ). Casting the result to float doesn't work either, as the division is done first and the result then casted to a float.

You are creating a variable called color in your code, which is destroyed at the line right after. You aren't using the variable you just created, it's destroyed right after. If you have a color variable in higher scope somewhere, use that one instead of creating a new one on that line.
Been over a week since last update/bump after answers, assuming solved.

/Closed.
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us