Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#8

Re: glDeleteTextures gibt Speicher nicht frei

  Alt 23. Mai 2008, 12:42
Ich lade sie so..

Delphi-Quellcode:
    if Assigned(QuadTexture) then
    begin
      glDeleteTextures(Length(QuadTexture), @QuadTexture[Low(QuadTexture)]);
      SetLength(QuadTexture, 0);
    end;

    glDeleteTextures(1, @BackTexture); // Texture für Hintergrund
    glDeleteTextures(1, @GradientTex); // Texture für DiskSpectrum
    glDeleteTextures(1, @MeterTexture); // Texture für VUMeter
    glDeleteTextures(1, @PeaksTexture); // Texture für Peaks
    glDeleteTextures(1, @SpectrumTexture); // Texture für Spectrum
    glDeleteTextures(1, @BarTexture); // Texture für Slider
    glDeleteTextures(1, @PrivateTexture); // Texture für CDLabel

    if assigned(aCovers) then
     aCovers.Free;

    // Lade Cover für Quader
    aCovers := TStringList.Create;
    if CoverPath <> 'then
    begin
      if CoverPath <> Path then
        ScanDirectory(CoverPath, 'bmp, tga, jpg', True);

      tmpC := 0;
      if (aCovers.count <= QuadCount) then
      begin
        for i := 0 to aCovers.count-1 do
        begin
          if (ExtractFileName(AnsiLeftStr(aCovers.Strings[i], Length(aCovers.Strings[i]) - 4)) = 'COVER')
            or (ExtractFileName(AnsiLeftStr(aCovers.Strings[i], Length(aCovers.Strings[i]) - 4)) = 'CDLABEL') then
            begin
              if FileExists(Path + UpperCase('Data\images\CompDisk\Default\NoCover.jpg')) then
                LoadTexture(Path + 'Data\images\CompDisk\Default\NoCover.jpg', quadTexture[i], False);
              dec(tmpC);
            end else
            begin
              LoadTexture(aCovers.Strings[i], quadTexture[tmpC], False);
            end;
            inc(tmpC);

        end;

        if (QuadCount >= (aCovers.count - 1)) then
        begin
          for q := (aCovers.count - 1) to QuadCount do
            if FileExists(Path + UpperCase('Data\images\CompDisk\Default\NoCover.jpg')) then
              LoadTexture(Path + 'Data\images\CompDisk\Default\NoCover.jpg', quadTexture[q-1], False);
        end;
        exit;
      end;


      tmpA := 0;
      if (aCovers.count >= QuadCount) then
      begin
        for i := 0 to aCovers.count-1 do
        begin
          if (ExtractFileName(AnsiLeftStr(aCovers.Strings[i], Length(aCovers.Strings[i]) - 4)) = 'COVER')
            or (ExtractFileName(AnsiLeftStr(aCovers.Strings[i], Length(aCovers.Strings[i]) - 4)) = 'CDLABEL') then
            begin
              if FileExists(Path + UpperCase('Data\images\CompDisk\Default\NoCover.jpg')) then
                LoadTexture(Path + 'Data\images\CompDisk\Default\NoCover.jpg', quadTexture[i], False);
              dec(tmpA);
            end else
            begin
              if (tmpA) <= QuadCount-1 then
                LoadTexture(aCovers.Strings[i], quadTexture[tmpA], False);
            end;
            inc(tmpA);
          end;

          if (QuadCount >= (aCovers.count - 1)) then
          begin
          for q := (aCovers.count - 1) to QuadCount do
            if FileExists(Path + UpperCase('Data\images\CompDisk\Default\NoCover.jpg')) then
              LoadTexture(Path + 'Data\images\CompDisk\Default\NoCover.jpg', quadTexture[q-1], False);
          end;
      end;
    end;
aCovers ist ne TStringList

Ok kann man besser machen
Das laden funktioniert ja lediglich das freigeben nicht

Zum laden benutze ich den Textureloader von Sulaco

gruss Emil
  Mit Zitat antworten Zitat