Re:how use Tbitmap to texture (OpenGL)
With a 24-bit bitmap, you can use the address of the image as the address of
the texture. If your hardware (OpenGL) driver supports the BGR format for
textures (and you set up texturing accordingly) you can use it as is,
otherwise you have to swap the R and B bytes of each pixel. My web site (see
link below) has some code at "Textured Cylinder" that does this. Granted it
loads from disk, but all you need is a pointer to the 24-bit data, whether
it came from disk or a bitmap created dynamically in memory. Indeed, if you
can create a bitmap in memory with the desired image, and if the sole
purpose is to use it as a texture, then you could create the texture
directly. Code for that is also on my site, this time at "Making an
in-memory RGBA texture" (This is code for 32-bit textures).
--
Jon
http://home1.gte.net/jqjacobs/index.htm
This posting was made entirely from recycled electrons. No innocent atoms
were harmed.
"Ral Armando Valadez Estrada" <macgy...@cantera.reduaz.mx> wrote in message
news:9012ts$sva15@bornews.inprise.com...
Quote
> Does anyone knows how to pass the Tbitmap data or timage.picture.bitmap
data
> to glTexImage2D(GL_TEXTURE_2D,.....)? I have some components that do it,
but
> it needs to load the bitmap from disk, and my actually images are created
by
> process or are passed from scaner to tbitmap or tpicture, I really dont
> know how to pass the bitmap info to glTexImage2d..
> Any clue??
> Ill apreciate any help.
> Thank you.