Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Color bug in Windows for my TINS entry

This thread is locked; no one can reply to it. rss feed Print
Color bug in Windows for my TINS entry
Mark Oates
Member #1,146
March 2001
avatar

Winnddooowwws! shakes fist

First I'm thrilled that I can actually run/test this on Windows. I was developing exclusively with Mac during the competition, and did do a quick build "check-in" on Windows to make sure the build was working, but never actually ran the executable.

(I did have to apply a patch to fix a hard-coded resource path to fix a run-time crash of my entry.)

Upon running, though, all the flowers are white. Some of the flowers appear to be blending into the stem indicating that the color values themselves are not correctly set. I think there may be a bug in the color initialization, or value assumptions of the ALLEGRO_COLOR data members/manipulation itself.

{"name":"612455","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/7\/f734c8765ee78594fc140eb94441d231.png","w":1990,"h":1193,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/7\/f734c8765ee78594fc140eb94441d231"}612455

I expect something more like this:

{"name":"612456","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/7\/87f6aab9d0e86921517347f5084f482c.jpg","w":960,"h":562,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/7\/87f6aab9d0e86921517347f5084f482c"}612456

Has anyone experienced seen something similar when working with colors?

(Official entry ZIP from TINS site if anyone wants to look)

UPDATE: Solved!!

It turns out my Windows machine actually implicitly initialized the ALLEGRO_COLOR alpha to 0, where on Mac it was 1. Either way, I neglected to initialize the value and it went unnoticed.

The actual bug started when I started using a new initialization technique
for ALLEGRO_COLOR, ALLEGRO_COLOR{255,255,255,255}, which actually should have been ALLEGRO_COLOR{1.0f,1.0f,1.0f,1.0f}.

With that in place, new odd things started happening during blend, and I attempted to fix it by simply not mixing the alpha during mix, assuming the problem was in my mix code and my lack of understanding of how to properly handle mixing and something with premultiplied alpha. In appearance, this fix worked because alpha was initializing to 1.0 on the Mac.

Later, the "actual" solution was added here, and the old alpha mixing "fix" was never put back.

I should have some binaries up shortly!

Nice job team!

video

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Go to: