Like in topic. Is it possible to use glBindTexture(GL_TEXTURE_2D, number) for numbers bigger than 1? Currently when I try to do this, I can see only untextured quads.
Here is my texture binding and usage code:
(TextureHolder is just class with texture and two int values)
public class Texture {
public static void create(int number, TextureHolder tex) {
glBindTexture(GL_TEXTURE_2D, number);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.width, tex.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.texture);
}
public static void load(int number) {
glBindTexture(GL_TEXTURE_2D, number);
}
public static void draw(TextureHolder tex, float x, float y, float angle) {
glPushMatrix();
glTranslated(x, y, 0);
glRotated(angle/(Math.PI/180), 0, 0, 1);
glBegin(GL_QUADS);
glColor4f(1,1,1,1);
glTexCoord2f(0,1); glVertex2f(-tex.height/2, -tex.width/2);
glTexCoord2f(0,0); glVertex2f(-tex.height/2, tex.width/2);
glTexCoord2f(1,0); glVertex2f(tex.height/2, tex.width/2);
glTexCoord2f(1,1); glVertex2f(tex.height/2, -tex.width/2);
glEnd();
glPopMatrix();
}
}
How I use it:
public void createTexture(String path) {
textureLoader = Tools.TextureLoader.create(path);
Texture.create(20, textureLoader);
}
@Override public void Draw() {
Texture.load(20);
Texture.draw(textureLoader, x, y, angleRad);
}