Results 1 to 10 of 11

Thread: zglTMemory

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Unhappy

    I am trying to SingleDataFileStorage with ZenGL and probably there is something wrong in my code:

    Code:
    function SFDS_Tex_Load(FileName,Extension :string) : zglPTexture;
    var
    TempStream : TMemoryStream;
    Reader :TSFDSFileReader;
    OutStream:TStream;
    OutStreamSize:Int64;
    begin
      TempStream := TMemoryStream.Create;
      Reader := TSFDSFileReader.Create('data.sfds',0 ); //Open GPK File
      OutStream := Reader.OpenStream(FileName, OutStreamSize);
      TempStream.LoadFromStream(OutStream);
      rama.Memory:= TempStream.Memory;
      rama.Size  := OutStreamSize;
      rama.Position:=0;
      Result     := Tex_LoadFromMemory( rama, Extension);
      TempStream.Free;
      TempStream := nil;
      OutStream.Free;
      OutStream:=nil;
    
    end;

  2. #2
    First of all try to use size value from TempStream.Size, not from OutStreamSize. If this didn't help then try to save TempStream into file(and look if this file is correct) and try to load texture from it. And just for to be sure - do you include units, which are needed to load texture with extension Extension?
    Last edited by Andru; 15-02-2011 at 10:59 PM.

  3. #3

    Talking Solved!

    Yep,I forgot to include JPG unit into source code now everything works like a charm.

    Code:
    procedure Init;
      var
        mehtexture : zglPTexture;
    begin
      
       mehtexture:= SFDS_Tex_Load( 'image.jpg', 'JPG' );
      end;
    Thanks for the help!

  4. #4
    Quote Originally Posted by gintasdx
    Yep,I forgot to include JPG unit into source code now everything works like a charm.
    Ehhh... seems I will rewrite all demos to use only ZenGL.dll, libZenGL.so and libZenGL.dylib, because everybody keep forgetting to include needed units... Or maybe I will implement showing this message - "YOU JUST FORGOT TO INCLUDE UNIT", hmm... this is an idea

  5. #5
    Well, the problem (if you can call it that) is that you don't get a hint of whats causing the error(in my case anyway). If you can solve that somehow then that'd be great.
    I quite like how you can choose between a dll or including the units yourself. To be honest it is one of the downsides of PyroGine, where you are forced to use the (imo bloated) dll.

  6. #6
    Maybe more hints in a log file would be cool. Having no DLL is great advantage since with SDL engine you need to carry 3 or 6 libraries.

    There is one minus that when you use static linking you must release the ugly source code. Well if I am right about LGPL licence.
    Last edited by gintasdx; 17-02-2011 at 03:56 PM.

  7. #7
    Quote Originally Posted by gintasdx
    There is one minus that when you use static linking you must release the ugly source code. Well if I am right about LGPL licence.
    Yes, you are right, and this is the only thing which I "ask for" in return for a lot of my open source code But as author I can make an exception for someone
    Last edited by Andru; 17-02-2011 at 07:05 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •