Bug just displaying an image!

Archives Forums/Blitz3D SDK Bug Reports/Bug just displaying an image!

Kale Kold(Posted 2011) [#1]
I was writing a object oriented wrapper for the blitz3d sdk dll using D but i keep running into awful bugs. This is as simple as they come. Can't even display a simple transparent png to the buffer without image corruption.

Original Image:



Sample code just using native B3D commands:

import blitzd.bindings.blitz3d;

void main(string[] Args)
{
	bbBeginBlitz3D();
	bbGraphics(640, 480, 32, 2);
	char *FileName = cast(char*)("images/skull.png" ~ "\0");
	int Skull = bbLoadImage(FileName);

	while (bbKeyHit(KEY_ESCAPE) < 1)
	{
		bbCls();
		bbDrawImage(Skull, 10, 10, 0);
		bbFlip(1);
	}

	bbEndBlitz3D();
}


Result:




Kale Kold(Posted 2011) [#2]
Just a thought, does blitz even support transparent pngs? or do it only support masks?

I'm assuming it does support transparent pngs from reading the documentation of the bbImagesCollide function:

Unlike bbImagesOverlap, bbImagesCollide does respect transparent pixels in the source images and will only return True if actual solid pixels would overlap if the images were drawn in the specified locations.


Last edited 2011


Kryzon(Posted 2011) [#3]
It's referring to transparent as in "masked", pixels masked with the bbMaskImage command.

Blitz3D does not support images with alpha channel. You only have access to masking pixels, and that's a real problem when you have antialiased graphics (you'll get a clearly noticeable outline).

It does support alpha-channel for textures, though: instead of using Blitz3D SDK's images, use pixel-perfect quads\sprites.
2D-in-3D is the way to go nowadays, and you can find a few libraries around for Blitz3D such as Draw3D (IMO the one you should go after), that offer this functionality.
It shouldn't be hard to port their logic to the SDK.

Last edited 2011


Kale Kold(Posted 2011) [#4]
Thanks Kryzon i'll look at the 3D stuff to implement the sprites. How would you go about pixel perfect collision using quads though?


Kryzon(Posted 2011) [#5]
As far as I know Draw3D doesn't do pixel-perfect collisions (w'd be too slow), just bounding-rectangle collisions.

It should be enough for most cases. Download the package and try it out :)
See ya.