inc(z);
bmp.canvas.Textout(20,20,inttostr(z));
bmp.Canvas.Brush.Color:=Cllime;
bmp.canvas.Textout(50,40,inttostr(z));
dc := GetDC(0);
xwidth := bmp.Width;
yHeight := bmp.Height;
for y := 0
to yHeight-1
do begin
l_ptr:=bmp.ScanLine[y];
for x := 0
to xwidth-1
do begin
l_r:= l_ptr.rgbBlue;
l_ptr.rgbBlue:=l_ptr.rgbRed;
l_ptr.rgbRed:=l_r;
l_ptr.rgbReserved:=1;
texdata[((yHeight-1)-y)*xwidth+x] := l_ptr^;
inc(l_ptr);
end;
end;
ReleaseDC(0,
dc);
if TextureID > 0
then glDeleteTextures(1, @TextureID);
glGenTextures(1, @ textureid);
glBindTexture(GL_TEXTURE_2D, cardinal(textureid) );
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_linear);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_linear);
glTexImage2D(GL_TEXTURE_2D, 0, 3, xwidth, yHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, @texdata);