Multitexturing problem in first frame

hi all,

i have a strange problem that only occurs in the very first rendered frame.
i do combine 2 textures in a fragment shader by multiplying them and it works great,
but in the first frame only the second texture (texture unit 1) is ‘valid’
and all texels in unit 0 seem to be 1,1,1.
in other words:

gl_FragColor = texture2D(tex0, texCoord) * texture2D(tex1, texCoord);

results in gl_FragColor = texture2D(tex1, texCoord);

the texture in unit 0 is somehow ignored.

here is some code:

void render()
{
int location = gl.glGetUniformLocation(shaderProg, “tex0”);
gl.glUniform1i(location, 0);
and for tex1

     gl.glActiveTexture(GL.GL_TEXTURE0);
     gl.glEnable(GL.GL_TEXTURE_2D);
     gl.glBindTexture(GL.GL_TEXTURE_2D, tex0.getTextureObject());
     and for tex1

     rendering

}

does somebody know this problem?
please help,
thanks

mike

the problem was that i created the textures inside the GLEventListener.display method.
when i create them in GLEventListener.init method it works.

will create a new topic on this…

i forgot to say, that both texture units (0 and 1) contain the second texture (tex1), not 1,1,1 in unit 0.