Advertisement

Blending not working

Started by October 02, 2003 06:03 AM
1 comment, last by Udi 21 years, 5 months ago
Hello Everybody, I''m trying to do a rather simple thing (I think): I''m trying to create a few white transparent squares floating over green and red squares. The odd thing is that no matter what I''m doing (and i''ve tried many combinations!) the transparency appears to be incomplete: only half the white squares appear transparent. To see what I mean go to the link: http://www21.brinkster.com/weirdhal/post.jpg (you might need to cut and paste the link into a browser window) What am I doing wrong??? My guess is that I''m doing something totally trivial.. but I can''t figure out what it is. Many many thanks!!!! Udi
Looks like an order problem. From the screenshot I''m guessing you render coloured squares over a black background, left to right and top to bottom. Do your coloured squares and your translucent white squares have the same z-value? If so then the problem is probably this:
+---+---+---+---+---+|   |   |   |   |   ||  ++---+---+---++  |+--++---+---+---++--+|  ||   |   |   ||  ||  ||   |   |   ||  |+--++---+---+---++--+|  ||   |   |   ||  ||  ||   |   |   ||  |+--++---+---+---++--+|  ||   |   |   ||  ||  ||   |   |   ||  |+--++---+---+---++--+|  +|---+---+---++  ||   |   |   |   |   |+---+---+---+---+---+

Hope you can see that diagram, it''s a grid of 5 by 5 squares with a larger square over the top.

Assume the small squares are numbered:
11  12  13  14  1521  22  23  24  2531  32  33  34  3541  42  43  44  4551  52  53  54  55

you render squares 11 to 15, 21 to 25 and 31 to 33. Then you render the translucent white square. At this point the translucent white square blends over the currently rendered squares. Next you render squares 34 to 35, 41 to 45 and 51 to 55. These are not blended and so replace your white square.

What you need to do is draw all of squares 11 to 55 before you draw the white translucent square (or, render all your opaque objects before any of your translucent ones).

Hope this helps,

Enigma
Advertisement
Thanks, Enigma!! That WAS it!!! I never would''ve figured this out on my own... many many thanks!!!

Udi

This topic is closed to new replies.

Advertisement