Skip to main content
gamedev.net
🔒 Locked

Difference between texture storing methods?

Started by Cakey 1 reply 800+ views
Original Post
Cakey
Cakey
So in Java OpenGL I've noticed there are two ways to have/use a texture. I was wondering what or if there are any differences between the two? Don't worry about the actual semantics of the code just the method 1.

Texture myTex = new Texture();
myTex = TextureIO.TextureIO.newTexture(new File(fileName), false);
//then to use
myTex.bind();
//Draw object routine
Versus 2.

int[] textureId = new int[nbTexture];

gl.glGenTextures( nbTexture, textureId, 0 );

gl.glBindTexture( GL.GL_TEXTURE_2D, textureId[4] );
Currently I am experiancing some problems using the first method, when it comes to replacing a texture(very strange errors). Which makes me wonder if the first method is meant to be dynamic or not? Anyone with any articles, or knowledge would be greatly appreciated, because this is holding me back from doing a lot of things.
Caste
Caste
To use textures in OpenGL, you have to generate IDs for them and call glTexImage2D or gluBuildMipmaps2D with the image data.

The Texture class you're using is probably part of your OpenGL framework (LWJGL or JoGL?), wich encapsulates these OpenGL calls. If you want to make sure that the texture works as expected, do the texture generation yourself → choose the 2nd option [wink].
Cakey
Cakey
Jogl is what I am using. See that's what I was wondering, Damn tutorials teaching me impractical things. Thank you caste!

Topic Locked

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

Sign in to reply to this topic.