• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

CreateGLTextureFromImage generated texture does not show up

Started by aksdb, 24 December 2006, 23:50:27

Previous topic - Next topic

aksdb

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 :(

aksdb

I forgot to attach the two images I generated to test it. Here they are.

Galfar

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).

aksdb

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 :-)

Galfar

Thanks for support.
Any new features you would like to see in future versions of Imaging?

aksdb

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 :)

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk