Blackcolor is not drawn

BlitzMax Forums/BlitzMax Beginners Area/Blackcolor is not drawn

Ravl(Posted 2012) [#1]
Hi all again,

While trying to create a FadeIN/OUT effect I observed in my game the black color RGB(0,0,0) is ignored. I set the CLS color to red and then I observed all the red "holes" from my scene.

Why is this happening?

I assume is something about the blend setting. I am using ALPHABLEND because I need transparency.


matibee(Posted 2012) [#2]
How do you draw your fade? A big black rect over the whole screen? In that case you've probably still got the alpha set too low.

alpha=0

while alpha < 1.0
  cls
    drawscene()
    setalpha alpha
    setcolor 0,0,0
    drawrect 0,0,width,height
  flip
  alpha :+ (1 / 60)
wend 



Ravl(Posted 2012) [#3]
If I am trying to draw a black rect (like in your example) is working great, but I still do not understand what is really happening.

Here are some more details:

I start my game with the following settings:
SetGraphicsDriver D3D9Max2DDriver()
Graphics 1280, 768, 0
SetClsColor(255, 0, 0)
SetBlend ALPHABLEND


-as you can see I set the clear screen to RED for now.

then in my RenderAll methods I call:

SetAlpha(1)
DrawImage objectBackgroundImage, 0, 0


Well, now I have a lot of red dots/portions all over the screen. Any portion of my image which is black (0,0,0) is not drawn.

If I use SetBlend SOLIDBLEND is drawing ok, but this is not an option. Also if I change the MaskColor to something else the black is draw now.

Am I making something wrong? I do not want to use 'mask colors'


matibee(Posted 2012) [#4]
Check your LoadImage flags are not setting the mask colour. The loadimage flags should probably just be..

LoadImage( yourfile, FILTEREDIMAGE )


Ravl(Posted 2012) [#5]
yap. that was the problem. forgot about flags. I use 0 and is ok now.

thank you a lot matibee :D


GfK(Posted 2012) [#6]
Am i right thinking you have a solid black 1024x768 image? That's the impression I get from the code above. That's horribly wasteful.

Instead, use a black 8x8 image, then DrawImageRect(img, 0, 0, 1024, 768). This will stretch the 8x8 image to the size of the screen, same effect, a fraction of the resources.

You could also just use DrawRect() instead of DrawImageRect().


Ravl(Posted 2012) [#7]
Thanks GfK,

As matibee said earlier I already use now: DrawRect

I just wanted to resolve the other problem :D