Hi,
I am starting my adventure with OpenGL; I started with Durian tutorial in C and it works fine. I want to port it to Java + JOGL (I will develop for Android, so I want to learn OpenGL under Java), and I get an error when setting up textures.
The code is:
final int[] gl_textures = new int[1];
gl.glGenTextures(1, gl_textures, 0);
int gl_texture = gl_textures[0];
gl.glBindTexture(GL2.GL_TEXTURE_2D, gl_texture );
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.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_EDGE);
// no error before this
gl.glTexImage2D( gl_texture,
0,
GL2.GL_RGB8,
image.getWidth(),
image.getHeight(),
0,
GL2.GL_BGR,
GL2.GL_UNSIGNED_BYTE,
image.getPixelBuffer()
);
// invalid enumerant here
Any clue what can be wrong?
I work OpenGL 2.1 (I know, old, but good to learn OpenGL ES). As I said, C tutorial code works fine.