thrash
thrash

Reputation: 187

JOGL - Multiple textures

In my project im looking to use a few textures for different objects.

At the minute I have the following code:

private Texture[] textures = new Texture[1];
private int texture1 = 0; // Which Filter To Use
private String textureFilename = "src/data/image.jpg";

And also textures[texture1].bind(gl); to bind it to the object, at the minute the texture is being bound to every object, which isnt what I want.

Im assuming theres a way to include a list of textures which can then be bound to each object? Just wondering how to do this, ive tried copying and editing the above code but its giving me errors so im guessing im doing it wrong.

Upvotes: 2

Views: 691

Answers (1)

sunny
sunny

Reputation: 11

private Texture[] textures = new Texture[1+more];
//private int texture1 = 0; // Which Filter To Use
private String textureFilename[1+more] = "src/data/image.jpg";

File textureFile = new File(textFile);
textures[any] = TextureIO.newTexture(textureFilename[any], true);

// draw
gl.glEnable(GL.GL_TEXTURE_2D);
texture[Index].bind();
texture[Index].enable();
`...

Upvotes: 1

Related Questions