Large amount of Texture Data

Started by
20 comments, last by 3Dgonewild 15 years, 6 months ago
Quote:Original post by bitshifter
Transferring bytes from disk to memory is the bottle-neck here
How do you know?
Advertisement
Quote:Original post by Crazyfool
I can load dds files with CreateTextureFromFileEx() right? But that alone wont solve my problems, right? I misunderstood that.

I am looking into figuring out how to do a texture loader (have been dealing with other bugs, so have not started on this yet, but I know the general direction which is why I made this post).

Thanks again!


I have no idea about DirectX , but actually it doesn't matter.
Its really easy to do it , it works well , and you'll get better loading times.

Here's how i've done it in the past (pseudo code)

Packing:
ImageStructure* img =  functionToLoadPngImageFromFile;open binary file outwrite header structure{img->wimg->himg->channelsbuffer size ( img->w * img->h * img->channels )}write buffer ( img->data , header.buffersize )we're done...


Loading:

TPackedTextureHeader t;open binary file fread ( (char*)(&t) , sizeof(TPackedTextureHeader) );unsigned char* pixels = new unsigned char [ t.buffer size ];//now just read the buffer without even moving in fileread(pixels,t.buffer size);bind pixels to a texturedelete [] pixels


Of course things can get a little bit more complicated if you're going to create
a "real packer" were you can pack more than 1 textures into 1 single file.

This topic is closed to new replies.

Advertisement