I am trying to get texture compression into my jogl program in which I have a sphere that I would like to use 2 different textures on at different times. These textures are large 8192x4096 images in .pgn format. If I want to switch which texture is being useful when rendering it takes at least 6 seconds on my mid-range 6 month hardware. This is not responsive enough.
Right now I use the following lines of code to place a texture on a gluSphere:
//stuff mostly in the constructor (the “glu” is a GLU object), I do this twice for the two textures
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricTexture(quadric, true); // I believe this tells it to automatically do the texture coordinates and mipmaps
Texture tex = null;
try{
tex = TextureIO.newTexture(new File(“image.png”),true);
tex.setTexParameteri(GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
tex.setTexParameteri(GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
}catch(Exception e){}
tex.bind();
//later on I call this to render the gluSphere
glu.gluSphere(quadric,10,100,100);
To switch between textures I call tex.bind() or tex2.bind() right before the gluSphere call.
Is this proper technique? Moreover, would adding texture compression improve the speed at which it can switch between my textures? Since the textures are so large I am concerned about them not fitting on my video memory simultaneously. However, I called “getEstimatedMemorySize()” on my textures and they returned 96MB for each texture which is less than the 256MB that I have to work with. I believe that my code does automatically make mipmaps which could increase the memory load to more than what I have available if I understand how that works. I noticed that my page file usage (I ran this on windows xp) increases from around 250MB to 1GB when I run my program, which seems to be more than would be possible even if everything were stored there.