TextureIO.newTexture returning same target

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TextureIO.newTexture returning same target

JeramieH
Humming right along on a new project and stuck. I call TextureIO.newTexture() on two different filenames, and it returns two different Texture objects, but they have the same texture target number and therefore render the same image. What's up with that? Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: TextureIO.newTexture returning same target

JeramieH
Here's the function as I'm calling it:
public Texture getTexture (String fname, GL2 gl2) throws Exception
        {
        Texture ret = TextureIO.newTexture(new File("data\\" + fname),false);
        System.out.println("getTexture("+fname+") returned OGL #"+ret.getTarget()+", Texture object:"+ret);
        return ret;
        }
and here's what happens:
Material01:crate.png
Material02:granite.jpg
getTexture(crate.png) returned OGL #3553, Texture object:com.jogamp.opengl.util.texture.Texture@503429
getTexture(granite.jpg) returned OGL #3553, Texture object:com.jogamp.opengl.util.texture.Texture@17bd6a1
and everything renders with the granite texture. The crate.png graphic was working fine alone, so I know that file is OK too.

Reply | Threaded
Open this post in threaded view
|

Re: TextureIO.newTexture returning same target

Demoscene Passivist
Administrator
Maybe u should provide more code to make things more clear, but it seems ur problem is somewhat related to this "texutre unit" thread ... guess ur binding the textures to the same texture unit before using them, thereby "overwriting" the "other" texture, wich ends up using only a single texture for rendering ...

Reply | Threaded
Open this post in threaded view
|

Re: TextureIO.newTexture returning same target

JeramieH
Doh, figured it out... I was using Texture.enable() but not including Texture.bind(). I was thinking Texture.enable() was all I needed before drawing my polys.

Thanks, your other thread showed me my error.