Login  Register

Re: Texture NPOT

Posted by elect on Sep 14, 2015; 8:48am
URL: https://forum.jogamp.org/Texture-NPOT-tp4035280p4035288.html

paolofuse wrote
Well, ok, I know this. I just wrote a simple test to show a texture. Using VBO the problem still remains.
To do the code work I must do:

TextureData textureData = TextureIO.newTextureData(gl.getGLProfile(), new File(filename), false, null);
IntBuffer buffer = IntBuffer.allocate(1);
gl.glGenTextures(1, buffer);
int textureID = buffer.get(0);
gl.glBindTexture(GL2.GL_TEXTURE_2D, textureID);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, textureData.getPixelFormat(), textureData.getWidth(), textureData.getHeight(), 0, GL2.GL_RGBA, textureData.getPixelType(), textureData.getBuffer());
gl.glBindTexture(GL2.GL_TEXTURE_2D, 0);

And then the past code works.
But why I cannot use simply Texture object?
There could be many reasons why it doesnt work as expected, may I see the full code?

You can use the texture object, but you should know what it does in the background, I'd discuss about it after the code, let's see first which are the problems at the begin