Hi,

as the subject says. I just realized that it does not work anymore (after 
working flawlessly for years). The latest svn revision that works for me is 
11800. Perhaps there are later revisions that work but some I could not compile 
and others did not start and I got tired of just randomly trying revision 
numbers and compile lazarus over and over. To me this looks like Marcs new 
image code is responsible for my troubles.
Btw I am using a TFPCustomImage descendant and the ImagesForLazarus package.
Here is the output of one of my programs trying to load an iamge:

TGtkWidgetSet.DeleteObject GdiObject=B7CDD100 gdiFont is still used. DCCount=1
DC: B7CD7220 08CEEB68=GtkWindow [RMVDStPr] LCLObject=B3926030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B69ABD80 gdiFont is still used. DCCount=1
DC: B7CD7D60 08E30748=GtkWindow [RMVDStPr] LCLObject=B2BD6030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42F6C20 gdiFont is still used. DCCount=1
DC: B7CD8120 08E4F188=GtkWindow [RMVDStPr] LCLObject=B2586030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42F7BE0 gdiFont is still used. DCCount=1
DC: B7CD84E0 08E9BD30=GtkWindow [RMVDStPr] LCLObject=B2206030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42F8BA0 gdiFont is still used. DCCount=1
DC: B7CD88A0 08EB4A98=GtkWindow [RMVDStPr] LCLObject=B1BB6030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42F9B60 gdiFont is still used. DCCount=1
DC: B7CD8C60 08F0D8F8=GtkWindow [RMVDStPr] LCLObject=B1566030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42FAB20 gdiFont is still used. DCCount=1
DC: B7CD9020 08F6AE88=GtkWindow [RMVDStPr] LCLObject=B0F16030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42FBAE0 gdiFont is still used. DCCount=1
DC: B7CD93E0 08F7BA18=GtkWindow [RMVDStPr] LCLObject=B0B96030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42FCAA0 gdiFont is still used. DCCount=1
DC: B7CD97A0 08FB5FF8=GtkWindow [RMVDStPr] LCLObject=B0816030=:TPromptDialog<Is 
MainWidget><Is CoreWidget>
TGtkWidgetSet.DeleteObject GdiObject=B42FDA60 gdiFont is still used.
DCCount=1
etc.

gdb bt (not helpfull, I know):

(gdb) bt
#0  0x08061e46 in fpc_raiseexception ()
#1  0x080a6880 in SYSUTILS_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER ()
#2  0x08064e17 in SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER ()
#3  0xbfa27d78 in ?? ()
#4  0x00000000 in ?? ()


and here is my code:

class defintion:

// Texture

  TTextureFilter = (nearest, bilinear, trilinear);

  { TAsmTexture2D }

  TAsmTexture2D = class(TFPCustomImage)
  private
    fAnisotropic: boolean;
    fBound: boolean;
    fFilterMode: TTextureFilter;
    fMipMapped: boolean;
    MagFilter: GLenum;
    MinFilter: GLenum;
    fSRepeat: boolean;
    fTRepeat: boolean;
    function GetPixel(x, y: integer): glubRGBColor;
    procedure SetAnisotropic(const AValue: boolean);
    procedure SetFilterMode(const AValue: TTextureFilter);
    procedure SetInternalColor(x, y: integer;
      const Value: TFPColor); override;
    function GetInternalColor(
      x, y: integer): TFPColor; override;
    SWrapMode: GLenum;
    TWrapMode: GLenum;
    procedure SetMipMapped(const AValue: boolean);
    procedure SetSRepeat(const AValue: boolean);
    procedure SetTRepeat(const AValue: boolean);
    procedure SetPixel(x, y: integer; const AValue: glubRGBColor);
    procedure SetPixel(x, y: integer; red, green, blue: GLubyte);
    // dummy procedures to avoid hints
    procedure SetInternalPixel(x, y: integer; value: integer); override;
    function GetInternalPixel(x, y: integer): integer; override;
  public
    Data: PGLubyte;
    id: GLuint;
    constructor Create(AWidth, AHeight: integer); override;
    destructor Destroy; override;
    function LoadFromFile(Filename: string): boolean;
    procedure SetSize(AWidth, AHeight: integer); override;
    //
    property Pixel[x, y: integer]: glubRGBColor read GetPixel write SetPixel;
    //
    property Anisotropic: boolean read fAnisotropic write SetAnisotropic;
    property Bound: boolean read fBound;
    property SRepeat: boolean read fSRepeat write SetSRepeat;
    property TRepeat: boolean read fTRepeat write SetTRepeat;
    property FilterMode: TTextureFilter read fFilterMode write SetFilterMode;
    property MipMapped: boolean read fMipMapped write SetMipMapped;
    procedure Bind;
    procedure UpdateRegion(x, y, AWidth, AHeight: integer);
  end;

loading code:

function TAsmTexture2D.LoadFromFile(Filename: string): boolean;
var
  FileStream: TFileStream;
  MemStream: TMemoryStream;
  ReaderClass: TFPCustomImageReaderClass;
  Reader: TFPCustomImageReader;
begin
  // open file
  try
    ReaderClass:=GetFPImageReaderForFileExtension(ExtractFileExt(Filename));
    FileStream:=TFileStream.Create(Filename, fmOpenRead);
  except
    ShowMessage('Error opening file');
    Result:=false;
  end;
  MemStream:=nil;
  try
    // read file into mem
    MemStream:=TMemoryStream.Create;
    MemStream.CopyFrom(FileStream,FileStream.Size);
    // convert stream to texture
    MemStream.Position:=0;
    if ReaderClass<>nil then begin
      Reader:=ReaderClass.Create;
      try
        LoadFromStream(MemStream, Reader); << This fails
        Result:=true;
      except
        Result:=false;
        Free;
        ShowMessage('Error reading file'); << because this I get in an endless 
loop
      end;
    end;
  finally
    FileStream.Free;
    MemStream.Free;
    Reader.Free;
  end;
end;

Thanks in advance for any help.

The not amused Lord of Darkness

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to