PDA

View Full Version : Getting Graphics.TBitmap's image memory



Andreaz
19-01-2003, 06:51 PM
Is there a way of getting the pointer to the Bitmap's data so it can be used with glBitmap ? What i wan't to do is this:

Bitmap.Width:=128;
Bitmap.Height:=128;
Bitmap.Canvas.Rectangle(0,0,128,128);

glBitmap(Bitmap.Width, Bitmap.Height, 0,0,0,0, ***);

Alimonster
19-01-2003, 08:12 PM
You could probably use TBitmap.Scanline - I'm not sure how glBitmap works, though, so I can't give you much more info :(. Make sure that you set your bitmap's PixelFormat to the relevant value too (pf32Bit or whatever is required for glBitmap) - ScanLine gets a bit annoyed if the pixelformat is the default, pfDevice.

You'd want to pass in the address of the first pixel of the first scanline, I suppose. I'm not sure how the bitmap's orientation (top-down or bottom-up scanlines) would come into the equation either.

I'm sure someone else around here has more insight than me on this. I'll defer to the next poster. Huzzah for vague posts!