Transparency Issue

BlitzPlus Forums/BlitzPlus Programming/Transparency Issue

Sauer(Posted 2010) [#1]
Hello,

I was hoping someone could tell me why this is not working correctly. This error is from a function I wrote to draw custom sized bordered boxes on the fly. It seems that the first time I call the function it works properly, but the second and all subsequent times it fails to mask the image color.

I stripped the function down to the bare minimum, and the issue remains. Here is the function:

Graphics 800,600,32,2
SetBuffer BackBuffer()

While Not KeyHit(1)
	Color 0,100,100
	Rect 0,0,800,600
	messagebox(10,10,100,100)
	messagebox(10,200,100,100)
	Flip
Wend

Function messagebox(x,y,width,height)
;draws a message box
	drawx=x
	drawy=y
	x=0
	y=0
	buttonimg=CreateImage(width,height)
	SetBuffer ImageBuffer(buttonimg)
		ClsColor 255,0,255
		Cls
		Color 255,0,0
		Rect 0,0,width/2,height/2		
	MaskImage buttonimg,255,0,255
	SetBuffer BackBuffer()
	DrawImage buttonimg,drawx,drawy
	FreeImage buttonimg
End Function


Notice the first call works correctly, but the second ignores the transparency and replaces it with black. Any information you can provide would be much appreciated.


Matty(Posted 2010) [#2]
I just tried it too, with the same problem. Sorry though - I cannot help you, it may be a bug since it doesn't look like there's anything wrong with that code of yours.


Floyd(Posted 2010) [#3]
It works correctly for me and always masks. That's with BlitzPlus 1.47, debug on or off.

My graphics card died recently, so I'm using integrated GeForce 6100.

Here is a slightly beefed up version with extra drawing and optional masking.




Sauer(Posted 2010) [#4]
Alright, so, thanks to Floyd's information, I've found that it works fine on the the native graphics driver and OpenGL driver, but fails in the Direct Draw driver.

The problem is the native driver is too slow and OGL crashes every time on close. Neither of those are acceptable.

Once again I'm stuck.

Any other advice?


GaryV(Posted 2010) [#5]
The OpenGL issue is a known bug and was reported years ago when the OpenGL driver was first introduced. It has nor been fixed and probably will not be (which is sad). The good news is the OpenGL bug only affects Graphics windows, it will not affect your game if you are using a GUI/Canvas window.


Sauer(Posted 2010) [#6]
Yes yes, it seems the more I investigate this problem, the more it points to switching over to a Canvas and use Event based input. That'll be a job...

EDIT: Preliminary edits to my code result in crashing on close. Internal error: attempt to release <unknown> object. Fixes found searching the forum, including adding "Setbuffer DesktopBuffer()" before end also fail, resulting in standard windows crash.

EDIT2: Also tried DX9 via Dabz Userlib, fails to start claiming "Userlib not found". Spoke with Dabz and he's looking over it now.

I'm so irritated I can barely see straight. About to abandon B+.

Last edited 2010

Last edited 2010