Re:OpenGL Texture image from a TBitmap
Try like this...
TMemoryStream *pm = new TMemoryStream ();
for (int i = 0; i < Canvas->Width; i++)
for (int j = 0; j < Canvas->Height; j++)
{
pm->Write(GetRvalue( Canvas->Pixels[i][j]));
pm->Write(GetGvalue( Canvas->Pixels[i][j]));
pm->Write(GetBvalue( Canvas->Pixels[i][j]));
// May be add alpfa channel here....
}
GLubyte *bitmap= (GLubyte*) pm->Memory;
//-----------------------------------------------
Next, use
void glBitmap(
GLsizei width,
GLsizei height,
GLfloat xorig,
GLfloat yorig,
GLfloat xmove,
GLfloat ymove,
const GLubyte *bitmap
);
"Damon Jacobsen" <codedra...@runbox.com> ???????/???????? ? ????????
?????????: news:3B98049E.5020006@runbox.com...
Quote
> I am trying to generate a Texture image for OpenGL using a TBitmap.
> OpenGL is expecting something along the lines of the following image
> variable.
> struct color
> {
> int red;
> int green;
> int blue;
> };
> color image[IMAGE_SIZE];
> I knwo passing canvas->Pixels wont work as the TColor does not
> correspont to the color array mentioned above. Is there any easy way to
> do this or do I have to convert pixel by pixel to the above format?
> Damon