What's the correct way to render DrawableTexture with alpha channel image. The DrawableTexture's color is different from source image when change the clear value (Texture.Clear(FloatColor($00FFFFFFFF)).I don't want to clear with $FFFFFFFF or other non-transparent value,because it must blend with background.

Code:
FillChar(LParameters, SizeOf(TTextureParameters), 0);
LParameters.Width := 567;
LParameters.Height := 600;
LParameters.Attributes := TextureDrawable;
LParameters.Format := TPixelFormat.RGBA8;
DrawableTexture := TextureInit(FDevice, LParameters);
SourceTexture := TextureInit(FDevice, 'c:/Test.png');
procedure TMainForm.RepaintWindow;
var
LFontSettings: TFontSettings;
LFlipped: Boolean;
LTexCoords: TQuad;
begin
if LFlipped then
LTexCoords := QuadUnity.Flip
else
LTexCoords := QuadUnity;
if DrawableTexture.Initialized then
begin
[COLOR=#e74c3c] //DrawableTexture.Clear(FloatColor($00FFFFFF));
//DrawableTexture.Clear(FloatColor($00AAAAAA));
//DrawableTexture.Clear(FloatColor($00FFFFFF));
DrawableTexture.Clear(FloatColor($0));[/COLOR]
if DrawableTexture.BeginScene then
try
if FCanvas.BeginScene then
try
FCanvas.Quad(SourceTexture, Quad(0, 0, 567, 600), LTexCoords, $FFFFFFFF);
LFontSettings := TFontSettings.Create('Segoe UI', 28.0 * FDisplayScale, TFontWeight.Thin);
LFontSettings.Effect.BorderType := TFontBorder.None;
FTextRenderer.FontSettings := LFontSettings;
FTextRenderer.Draw(Point2f(156.0, 510.0), 'Drawable Texture', ColorPair($FFFFFFFF));
finally
FCanvas.EndScene;
end;
finally
DrawableTexture.EndScene;
end;
end;
if FDevice.Initialized and FDevice.BeginScene then
try
FDevice.Clear([TClearLayer.Color], FloatColor($FFBBBBBB));
if FCanvas.BeginScene then
try
FCanvas.Quad(SourceTexture, Quad(0, 100, 567, 600), LTexCoords, $FFFFFFFF);
LFontSettings := TFontSettings.Create('Segoe UI', 28.0 * FDisplayScale, TFontWeight.Thin);
LFontSettings.Effect.BorderType := TFontBorder.None;
FTextRenderer.FontSettings := LFontSettings;
FTextRenderer.Draw(Point2f(156.0, 610.0), 'Source Texture', ColorPair($FFFFFFFF));
FCanvas.Quad(DrawableTexture, Quad(600, 100, 567, 600), LTexCoords, $FFFFFFFF);
finally
FCanvas.EndScene;
end;
finally
FDevice.EndScene;
end;
FTimer.Execute(True, False);
end;

) and only shared it with a friend. Maybe after 15 years I need to finish it some day!
Comment