Skip to main content
gamedev.net
🔒 Locked

Basic question about texture compression in java opengl

Started by dsr12 0 replies 800+ views
Original Post
dsr12
dsr12
I would like to use compressed textures because all the texture data that I want to use in my opengl application is too large to fit in the video ram simultaneously. To give a little background I have only one object that I am rendering a gluSphere with an 8192x4096 .png texture on it. I would like to switch between several of these textures. Unfortunately, these textures are massive and it can take over 6 seconds to switch between them on my laptop that has a Geforce 8400. I am new to opengl and have only used it through jogl so any advice is appreciated. To load and use one of my images as a texture I do the following: (I have to import "java.io.File" for the creation of the file object) //stuff mostly in the constructor (the "glu" is a GLU object) GLUquadric quadric = glu.gluNewQuadric(); glu.gluQuadricTexture(quadric, true); 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); The above code omits a bunch of stuff, but I think it includes all of my relevant lines of code to load a given image and place it on a sphere. How would I change this to use compression and what are my options if I have any? I have seen references to functions called "glCompressedTexImage2D" and "glTexImage2D," but I do not really know what to do with them or even if they would apply to my problem. The documentation on the javadoc is not useful to someone like me who has limited background in this stuff.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.