Hi, I was just wondering if there is some smarter way of getting texture data to OpenGL using imageio.
Basically when I load a texture with imageio I get a BufferedImage it return. Then i need to copy the data to an int[] and (might also need to copy int[] to a ByteBuffer, if I don’t the JNI layer will probably still do an extra copying ) then I can bind the data to GL.
Like this:
Image image = ImageIO.read(file);
int[] rgb = image.getRGB(....);
byteBuffer.put(rgb);
glTexImage2D(....)
The problem is that this approach waste a lot of memory under during a short timeframe and if you are handling a large set of textures this is real problem.
I could write my own imageio->bytebuffer but that dosen’t sound like a fun approach.
Any solutions ?
// Tomas