TextureIO.newTexture() slow? (moving image to texture buffer on graphics card)

Hello everyone,

I wanna make a threaded loading of textures in my engine, but the transfer of textures from main memory to the memory on graphics card is slower than reading from my harddrive… This sounds weird…

Look at my example:


            double time = System.currentTimeMillis();
            BufferedImage bi = ImageIO.read(getClass().getResource(fileName));
            TextureData texData = new TextureData(bi.getType(), bi.TYPE_INT_ARGB, false, bi);
            System.out.println("time to load tex from hdd:" + (System.currentTimeMillis() - time));
            time = System.currentTimeMillis();
//            text = TextureIO.newTexture(bi, false);
            text = TextureIO.newTexture(texData);

            System.out.println("time to load tex into graphics card:" + (System.currentTimeMillis() - time));

This results in the following test output:


time to load tex from hdd:116.0
time to load tex into graphics card:382.0
time to load tex from hdd:49.0
time to load tex into graphics card:280.0
time to load tex from hdd:38.0
time to load tex into graphics card:67.0
time to load tex from hdd:92.0
time to load tex into graphics card:71.0
time to load tex from hdd:40.0
time to load tex into graphics card:52.0
time to load tex from hdd:32.0
time to load tex into graphics card:51.0
time to load tex from hdd:32.0
time to load tex into graphics card:53.0
time to load tex from hdd:33.0
time to load tex into graphics card:52.0
time to load tex from hdd:33.0
time to load tex into graphics card:54.0

Please help me, im stuck with this. I am certain that the transfer from main memory to graphics-memory should be way faster than Harddisk Access…

Bump…I really need help on this issue :slight_smile:

I’d be more surprised if they were running at the same speed then at different speeds. It’s two different operations, one is always going to be faster then the other.

You can load your texture yourself with OpenGL using the glGenTextures and glTexImage2D functions. There are plenty of tutorials online that explain how to do this. This would avoid all of the TextureIO stuff, but unless it’s doing something silly I doubt there would be much of a speed improvement.

Yes that’s what I was thinking, but I hope it’s doing something silly, because it seems VERY strange that hdd-access is faster than memory-transfer between fast volatile-RAM memory.

Hmm, but yeah I think I can manage generating my own textures in OpenGL since it looks the same as displaylists which I have experience with.