<p>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. </p>

<p>In my Init function I call:</p>

<pre><code>Gl.glGenTextures(1, mTextures);
</code></pre>

<p>Since only one image will be displayed at time, I am using the same texture name for each image. </p>

<p>Each time a new image is loaded I call the following:</p>

<pre><code>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);
</code></pre>

<p>The first image will display as expected. However, all images load after the first, display as all black.</p>

<p>What am I doing wrong?</p>

When do you submit the geometry using these textures? I assume that is interleaved with the texture loading, although you don't show that. Of course, if you are going to replace the texture name with different images, you don't need to use texture names at all, do  you? You could just do the
```
glTextImage2D
```
call when you need to set a new texture, and then use that for as long as necessary, never involving
```
glBindTexture()
```
at all.
An obvious thing to do is of course to insert error-checking code, OpenGL stores an error code when an operation fails and this code is not overwritten until read by the application. See
glGetError()
for more on this.