Vampyre Imaging Library Forum

Imaging Category => Help & Questions => Topic started by: aksdb on 24 December 2006, 23:50:27

Title: CreateGLTextureFromImage generated texture does not show up
Post by: aksdb on 24 December 2006, 23:50:27
I have a problem generating a texture from an ImageData. The image is generated during runtime as ifA1R5G5B5 by directly writing to the memory behind image.Bits
It is then converted to ifA8R8G8B8 and used throughout the application. If I draw it to a canvas (DisplayImage) it works just fine. I can even save it to a file and it displays just fine. But if I convert it to a texture it is not displayed at all.
To test the behavior I created a bitmap file using delphi's TBitmap.Scanline and saved that as F2A.bmp and created a second one using TImageData.Bits under lazarus and saved it as F2A_.bmp. I then generated the texture by using LoadGLTextureFromFile("F2A.bmp") and for the second one LoadGLTextureFromFile("F2A_.bmp"). The first one (TBitmap generated) is displayed correctly where the second one (TImageData generated) does still not show up, although both files can be viewed in any graphics application (I used xnView and Pixel to test it). Maybe someone can see more, but currently I suspect the problem within the imaging library. I'm just not able to find a solution :(
Title: Re: CreateGLTextureFromImage generated texture does not show up
Post by: aksdb on 25 December 2006, 00:37:48
I forgot to attach the two images I generated to test it. Here they are.
Title: Re: CreateGLTextureFromImage generated texture does not show up
Post by: Galfar on 25 December 2006, 02:25:10
I've looked at those images you sent and problem is probably caused by this:
Data format is A1R5G5B5 but that A1 bit is always set to zero. DisplayImage
shows image OK because it doesn't do any alpha blending. On the other hand,
you probably have alpha blending enabled in your OpenGL app and because
whole alpha channel of image is zero you don't see anything (try to disable
blending in OpenGL to see if there is any change). 
You could use X1R5G5B5 or R5G6B5 data format if you don't need alpha
or just set that A1 bit of A1R5G5B5 image to 1.

Please let me know if any of this helped (or not helped).
Title: Re: CreateGLTextureFromImage generated texture does not show up
Post by: aksdb on 25 December 2006, 13:39:31
That was indeed the problem. As I need transparency I will just set the alpha bit before processing the pixel.
Your imaging library is really great. Saves me much trouble with lazarus and cross platform development
(as TBitmap does not have scanline and as I need the image as well in OpenGL as for TCanvas).

Thanks for the fast help and for that great work :-)
Title: Re: CreateGLTextureFromImage generated texture does not show up
Post by: Galfar on 25 December 2006, 14:26:07
Thanks for support.
Any new features you would like to see in future versions of Imaging?
Title: Re: CreateGLTextureFromImage generated texture does not show up
Post by: aksdb on 25 December 2006, 15:23:04
The only thing I would like for future versions if most likely already on your list:  more canvas functions
as they are available in Delphi (for example drawing and/or filling circles and/or circle sections), as
many of these functions are not even available in Lazarus' TCanvas implementation.
If I have another idea I'll let you know :)