Hi all,
i was woundering if it is possible to extract data from TPicture and use it in OpenGL? any ideas??
Thanx for any help
M109uk
Hi all,
i was woundering if it is possible to extract data from TPicture and use it in OpenGL? any ideas??
Thanx for any help
M109uk
M109uk
<br />--------------------------------------------------------
<br />www.pulse-soft.oneuk.com
My answer is "it's probably possible." I can't say that I know off-hand, but when it comes down to it, TBitmap is just a bunch of pixels, which is what OpenGL likes . One problem would be ordering of colours (bgr versus rgb) -- dunno if that would factor into things, since I've not investigated the matter myself. You might have to manually swap the order (not a big deal, but not exactly handy for speed), though maybe not.
First of all, the TPicture.Bitmap property will get you a TBitmap. You might try something along the lines of the following: set the bitmap's pixel format to a known value so that it's not pfDevice (e.g. MyPic.Bitmap.PixelFormat := pf32Bit). Then, you can take a look at the scanline property of the picture's bitmap and pass it to the relevant function(s) in OpenGL using the address of scanline[0]^[0] or scanline[bmpheight - 1]^[0] (not sure which is appropriate). Will the padding-to-dword for each scanline affect things? Who knows!
If you don't care much about speed, the simple solution would be to create a dynamic array of byte, size it appropriately, then do some blockreads for the bitmap's scanlines.
Can you tell that I don't use the VCL much with OpenGL?
Try the usual suspects to see if they have any examples. Hopefully someone with more knowledge will chime in here.
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
Thanks for your idea, i found something on the web with the same idea, and am now adding it in :twisted:
heres the link http://www.delphifr.com/article.aspx?Val=2218
Its in french, but most of it is easily worked out.
Just one last question about this though, i've got a feeling that TPicture wont store the alpha channel for TGA files, im using the GraphicEx library to read them, and im not sure how i can dig out the alpha channel or if it stores it?? do you have any idea about this??
Thanks for your help..
M109uk[/url]
M109uk
<br />--------------------------------------------------------
<br />www.pulse-soft.oneuk.com
Bookmarks