Hi,
I'm stuck since few days with texture loading :
try{
TextureData pict = TextureIO.newTextureData(GLProfile.getGL2GL3(),
new File(texChemin+"picture.jpg"),GL2GL3.GL_RGBA,GL2GL3.GL_RGBA,false,"jpg");
ByteBuffer pictData=ByteBuffer.allocate(4*pict.getWidth()*pict.getHeight());
System.out.println(pictData.capacity()+" "+pict.getBuffer().capacity());
pictData=(ByteBuffer) pict.getBuffer();
gl.glActiveTexture(GL2GL3.GL_TEXTURE0);
int[] texID=new int[1];
gl.glGenTextures(1, texID, 0);
gl.glBindTexture(GL2GL3.GL_TEXTURE_2D, texID[0]);
gl.glTexParameterf(GL2GL3.GL_TEXTURE_2D, GL2GL3.GL_TEXTURE_MAG_FILTER, GL2GL3.GL_LINEAR);
gl.glTexParameterf(GL2GL3.GL_TEXTURE_2D, GL2GL3.GL_TEXTURE_MIN_FILTER, GL2GL3.GL_LINEAR);
gl.glTexImage2D(GL2GL3.GL_TEXTURE_2D, 0, GL2GL3.GL_RGBA, pict.getWidth(),
pict.getHeight(), 0, GL2GL3.GL_RGBA, GL2GL3.GL_UNSIGNED_BYTE, pictData);
int loc=gl.glGetUniformLocation(programHandle, "Tex1");
if(loc>=0) {
gl.glUniform1i(loc, 0);
}else{
System.err.println("Uniform variable Tex1 not found! "+loc);
}
}catch(IOException exc) { }
My jpeg is 1920x1080 resolution.
I obtain this error : "java.lang.IndexOutOfBoundsException: Required 8294400 remaining bytes in buffer, only had 6220800"
on the glTexImage2D line.
Thanks for your "lights".