Results 1 to 9 of 9

Thread: Loadtexture form memory?

  1. #1

    Loadtexture form memory?

    I use the
    function LoadTexture(Filename: String; var Texture: GLuint; LoadFromRes : Boolean): Boolean;

    I save an image to a streammemory name imagestrmemory.
    How can i load from the memory an put in the loadtexture function so i can show it any time i want.

    Thanks...

  2. #2
    I guess you need to specify what libraries you use. I'm not familiar with LoadTexture() with those parameters.

    That function only seems capable of loading from file or resource. I'm not sure if you can put a file from stream into resource at runtime... If not, you have to put the images to the resources before compiling.

  3. #3
    Quote Originally Posted by User137 View Post
    I guess you need to specify what libraries you use. I'm not familiar with LoadTexture() with those parameters.

    That function only seems capable of loading from file or resource. I'm not sure if you can put a file from stream into resource at runtime... If not, you have to put the images to the resources before compiling.
    Yes this function loads an image file from the disk...

    If anybody have a function that loads image from stream please post it here.

  4. #4
    This function is from which library?
    From brazil (:

    Pascal pownz!

  5. #5
    Quote Originally Posted by arthurprs View Post
    This function is from which library?
    from :
    // Author : Jan Horn
    // Email : jhorn@global.co.za
    // Website : http://home.global.co.za/~jhorn
    // Version : 1.01
    // Date : 1 May 2001
    // Description : A unit that used with OpenGL projects to load BMP and TGA
    // files from the disk or a resource file.
    // Usage : LoadTexture(Filename, TextureName, LoadFromResource);
    //
    // eg : LoadTexture('logo.tga', LogoTex, TRUE);
    // will load a TGA texture from the resource included
    // with the EXE. File has to be loaded into the Resource
    // using this format "logo TGA logo.tga"

    very old but good...

    function LoadTexture(Filename: String; var Texture : GLuint; LoadFromRes : Boolean) : Boolean;
    begin
    result:=false;
    if copy(filename, length(filename)-3, 4) = '.bmp' then
    result:=LoadBMPTexture(Filename, Texture, LoadFromRes);
    if copy(filename, length(filename)-3, 4) = '.tga' then
    result:=LoadTGATexture(Filename, Texture);
    end;

    The function either load bmp image or tga with alpha or not...

  6. #6
    In that case it might not be too impossible to look into LoadBMPTexture() and so forth, and then write a function LoadFromStreamBMP() that takes stream as parameter.

    I haven't used streams in my own texture units just because i don't see reason to. Only purpose of streams would be to keep the texture in the physical memory instead of video memory, and for that purpose i can load texture from TBitmap.

    However if i consider a case in game where i have 100 fullscreen loading screens for different levels it would be quite silly to load every one of them waiting in memory. Loading time from file is very fast also unless those functions are bad, but it also keeps the memory use lower.

  7. #7
    Quote Originally Posted by User137 View Post
    In that case it might not be too impossible to look into LoadBMPTexture() and so forth, and then write a function LoadFromStreamBMP() that takes stream as parameter.

    I haven't used streams in my own texture units just because i don't see reason to. Only purpose of streams would be to keep the texture in the physical memory instead of video memory, and for that purpose i can load texture from TBitmap.

    However if i consider a case in game where i have 100 fullscreen loading screens for different levels it would be quite silly to load every one of them waiting in memory. Loading time from file is very fast also unless those functions are bad, but it also keeps the memory use lower.
    I have the same opinion with you about loading images from file.
    Something is wrong with the load bmp file.
    The scene is this i have a cube with diferent texture in every plane of the cube.
    With the hit of the key must delete the old ones and load another.
    One texture is about 630 kb each, so 630x6 = 3780 3.6mb.
    I think is big so i load instantly from a zip file that contains the six textures.
    But from zip i can extract in memory (using 7zip header from progdigy.com) and i want to take it from the memory and put it in the cube.

    Any good idea is acceptable

  8. #8
    You can modify the library (attach the files so we can take a look) or use another library (like http://imaginglib.sourceforge.net/ ).
    From brazil (:

    Pascal pownz!

  9. #9
    Quote Originally Posted by arthurprs View Post
    You can modify the library (attach the files so we can take a look) or use another library (like http://imaginglib.sourceforge.net/ ).
    That is my first thought but i thing i ask here (there are many great programmers here) to take an opinion.

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
  •