This reverts commit eb6101d2ec2d7828c40bccf4195a2bf3ec13780a. reverting textures
45 lines
897 B
Java
45 lines
897 B
Java
package org.hl.engine.graphics;
|
|
|
|
import org.hl.engine.utils.TextureLoader;
|
|
import org.lwjgl.opengl.GL11;
|
|
import org.lwjgl.openvr.Texture;
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
public class Material {
|
|
|
|
private Texture texture;
|
|
|
|
private BufferedImage image;
|
|
|
|
private int width, height;
|
|
private int textureID;
|
|
|
|
public Material(String path) {
|
|
|
|
this.image = TextureLoader.loadImage(path); //The path is inside the jar file
|
|
|
|
}
|
|
public void create() {
|
|
this.width = this.image.getWidth();
|
|
this.height = this.image.getHeight();
|
|
this.textureID = TextureLoader.loadTexture(image);
|
|
}
|
|
|
|
public int getWidth() {
|
|
return width;
|
|
}
|
|
|
|
public int getHeight() {
|
|
return height;
|
|
}
|
|
|
|
public int getTextureID() {
|
|
return textureID;
|
|
}
|
|
|
|
public void destroy() {
|
|
GL11.glDeleteTextures(textureID);
|
|
}
|
|
}
|