Login  Register

help using TextureIO.newTexture() ???

Posted by cylob on Nov 26, 2023; 5:50pm
URL: https://forum.jogamp.org/help-using-TextureIO-newTexture-tp4043164.html

I'm coming from doing opengl with java on android. The way I have it there is when I go to load a texture, I specify an ID for the texture ahead of time, then i call the following before teximage2d uploads the image:

    glActiveTexture(GL_TEXTURE0+ID);

and after teximage2d i call:

    glUniform1i(glGetUniformLocation(shaderID,"tex_unit"+String.valueOf(ID)),ID);

and in this way, i can just associate a tex id in my vertex buffers to a tex_unitN in my frag shader....thats just how i do things so i dont have to mess with binding textures and stuff in my draw loop....but i cant seem to figure out how to do this with jogl because newTexture() doesnt let you specify an id, does anyone know if i can do this? thanks for your help plz