I have an OpenGl program in which I am displaying an image using textures. I want to be able to load a new image to be displayed.
In my Init function I call:
Gl.glGenTextures(1, mTextures);
Since only one image will be displayed at time, I am using the same texture name for each image.
Each time a new image is loaded I call the following:
Gl.glBindTexture(Gl.GL_TEXTURE_2D, mTexture[0]);
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_LUMINANCE, mTexSizeX, mTexSizeY, 0, Gl.GL_LUMINANCE, Gl.GL_UNSIGNED_SHORT, mTexBuffer);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
The first image will display as expected. However, all images load after the first, display as all black.
What am I doing wrong?