- var
- Data: Array of LongWord; //beinhaltet später die Pixeldaten vom Bitmap die an OpenGL übergeben werden
- W, Width: Integer;
- H, Height: Integer;
- bmp: Tbitmap;
- C: LongWord;
- Line: ^LongWord;
- begin
- bmp := Tbitmap.Create;
- bmp.pixelformat := pf32bit;
- bmp.loadfromfile('deine datei.bmp');
- Width := bmp.Width;
- Height := bmp.Height;
- SetLength(Data, Width * Height);
- For H := 0 to Height - 1 do
- Begin
- Line := bmp.scanline[Height - H - 1];
- For W := 0 to Width - 1 do
- Begin
- C := Line^ and $FFFFFF;
- Data[W + (H * Width)] := (((C and $FF) shl 16) + (C shr 16) +
- (C and $FF00)) or $FF000000;
- inc(Line);
- End;
- End;
- bmp.Free;
- Texture := CreateTexture(Width, Height, GL_RGBA, addr(Data[0])); //Mit der Funktion von unten werden hier die Daten in eine textur geladen. Texture ist vom Typ GluInt, deine TEX-Variable.