Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   wie werden Löcher im Bitmap dargestellt (https://www.delphipraxis.net/180899-wie-werden-loecher-im-bitmap-dargestellt.html)

luisk 29. Jun 2014 18:29

wie werden Löcher im Bitmap dargestellt
 
neues Problem:
wie werden Löcher in einem Bitmap dargestellt, und wie kann man die in OpenGL übermitteln ?
ich über mittle die Bits über die Structur RGBQuad
Delphi-Quellcode:
RGBQuad.rgbBlue:Byte;
RGBQuad.rgbGreen:Byte;
RGBQuad.rgbRed:Byte;
RGBQuad.rgbReserved:Byte;
Es funktioniert gut.
Löcher wären jetzt noch interessant. Wie geht sowas ?

Hab inzwischen herausgefunden, dass man Alpha-Blending braucht.
Kennt jemand ein einfaches Beispiel ?

Delphi-Quellcode:
   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);

Aphton 29. Jun 2014 20:26

AW: wie werden Löcher im Bitmap dargestellt
 
Siehe hier


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:38 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz