SetClsColor - strange behaviour

BlitzMax Forums/BlitzMax Programming/SetClsColor - strange behaviour

Qweeg(Posted 2005) [#1]
Can shed any light on this please? Below is some code that just tests for a collision. For the purpose of this test two images are tested at exactly the same position - so there should always be a collision. However on my PC if I have the SetClsColor set to 2,2,2 then there is no collision. If I change it to 5,5,5 then there is a collision? If I don't put the SetClsColor line in at all then there is no collision.

What on earth has SetClsColor got to do with the return from the ImagesCollide() function?

Any explanations would be gratefully received.

Graphics 640,480
Setclscolor 5,5,5
'Setclscolor 2,2,2

' create a circle test image
Local image=CreateImage(64,64,1,DYNAMICIMAGE|MASKEDIMAGE)
Cls ; DrawOval 0,0,64,64 ; GrabImage image,0,0
midhandleimage(image)

' create a single pixel dummy image
dummyCursorImage=CreateImage(1,1,1,DYNAMICIMAGE|MASKEDIMAGE)
Plot 0,0 ; GrabImage dummyCursorImage,0,0


Repeat
	Cls
	'mx=MouseX() ; my=MouseY()
	' draw the circle image
	DrawImage image,200,100
	' test for collision against dummy image
	result=ImagesCollide(image,200,100,0 , dummyCursorImage,200,100,0)
	DrawText "Collision = "+Mid$("NO YES",result*4,3) , 10,10
	Flip
	FlushMem
Until KeyHit(KEY_ESCAPE)

End



taxlerendiosk(Posted 2005) [#2]
I get Collision = YES with 5, 2, and no line...


Gabriel(Posted 2005) [#3]
I also get a collision all three ways. I tried all three variations in debug mode and release mode too. Always get a collision.


Qweeg(Posted 2005) [#4]
Thanks guys - I wondered if that might happen. The PC I am doing this on also has a problem with DrawOval - it doesn't work. The DrawOval issue was raised by a couple of people on other threads and I guess it is maybe to do with the graphics driver on this PC (it is my rubbishy work PC). It does have the latest version of Directx though so I don't think its that. I'll try this on my home PC later - sounds like it will be fine there.

Oh well it's not really a biggy - just odd that this should happen on some PCs and not others (and it took me ages to work out what the problem was - Doh!).


amonite(Posted 2005) [#5]
i 've got a rubbishy work PC as well, and i can't even display an image or simply drawtext unless i use
GLMax2DDriver ( ) !


Gabriel(Posted 2005) [#6]
Yeah, you might try some different videocard drivers and the GLMax2dDriver() but if neither of those works, it's still a bug, even if it only affects a small number of people. Really, really weird command to have any effect on collisions though.


Leiden(Posted 2005) [#7]
Yup they all work for me too... but how would gfx drivers effect collisions? I thought all the gfx drivers did was render stuff - therefore collisions should work, but be rendered crappily.


skidracer(Posted 2005) [#8]
If plot isn't correctly pixel aligned GrabImage dummyCursorImage,0,0 will simply be retrieving the CLS color.

On 16 bit hardware the cls color will be rounded to 0,0,0 for 2,2,2 and 0,4,0 for 5,5,5 hence why cursorimage is being treated as completely transparant with ClsColor 2,2,2 running in 16 bit with a borked plot command.

In regards to the broken plot command, Qweeg, can you please post your graphics card and driver version.

Benyboy, can you please is possible let us know the results you have with this test.


Qweeg(Posted 2005) [#9]
Wow, thanks for shedding some light on this Simon - I thought I had gone completely mad!

My Graphics card is an:
Intel(R) 82865G
and the driver is:
6.13.10.3510


amonite(Posted 2005) [#10]
@skidracer,
my rubbishy PC specs :
PC P3 800mhz + MB HP Vectra VL400 + GC intel 82815 (4mo) + 3D intel i752 + 254MO ram ...

the firePaint test doesn't work for me, makes my screen
blink :(