本文整理匯總了Java中org.newdawn.slick.opengl.Texture.getTextureID方法的典型用法代碼示例。如果您正苦於以下問題:Java Texture.getTextureID方法的具體用法?Java Texture.getTextureID怎麽用?Java Texture.getTextureID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.opengl.Texture
的用法示例。
在下文中一共展示了Texture.getTextureID方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(final String fileName) {
Texture texture = null;
try (final FileInputStream inputStream = new FileInputStream(getResourcePath("textures/" + fileName + ".png"))) {
texture = TextureLoader.getTexture("PNG", inputStream);
} catch (final IOException ex) {
LOGGER.error("Exception occurred - {} while loading texture file - {}", ex, fileName);
}
assertTextureNotNullForFileName(texture, fileName);
final int textureId = texture.getTextureID();
textures.add(textureId);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
return textureId;
}
示例2: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(String fileName) {
Texture texture = null;
try {
texture = TextureLoader.getTexture("PNG", new FileInputStream(Primary.fileHandler.getTexture(fileName)));
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER,
GL11.GL_LINEAR_MIPMAP_LINEAR);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0f);
} catch (Exception e) {
e.printStackTrace();
System.err.println("Tried to load texture " + fileName + ".png , didn't work");
System.exit(-1);
}
textures.add(texture.getTextureID());
return texture.getTextureID();
}
示例3: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(String fileName) {
Texture texture = null;
try {
texture = TextureLoader.getTexture("PNG", new FileInputStream("res/"+fileName +".png"));
// Mipmapping to lower resolution of distance textures
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
// Changes the level of detail to change the mipmapping to a slightly higher resolution
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, -0.4f);
} catch (IOException e) {
e.printStackTrace();
}
//TODO fix null assertion
int textureID = texture.getTextureID();
textures.add(textureID);
return textureID;
}
示例4: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(String fileName) {
Texture texture = null;
try {
texture = TextureLoader.getTexture("PNG",
new FileInputStream(MainGameLoop.fileManager.getTextureFile(fileName)));
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
float amount = Math.min(4f,
GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
amount);
} else {
System.out.println("Filter Anisotropic Not Supported");
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("Tried to load texture " + fileName + ".png , didn't work");
System.exit(-1);
}
textures.add(texture.getTextureID());
return texture.getTextureID();
}
示例5: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
/**
* Loads a texture from file, under resources/assets/ folder type / file name.png
* @param fileName - Name of the texture
* @param folderType - Used to find the texture since it's organized.
* @return - TextureID used for program
*/
public int loadTexture(String fileName, int folderType) {
Texture texture = null;
String folderName = "textures";
if(folderType == Reference.LOADER_MAPS_FOLDER) folderName = "maps";
if(folderType == Reference.LOADER_NORMALS_FOLDER) folderName = "normals";
if(folderType == Reference.LOADER_FONTS_FOLDER) folderName = "fonts";
if(folderType == Reference.LOADER_PARTICLES_FOLDER) folderName = "particles";
if(folderType == Reference.LOADER_SPECULARS_FOLDER) folderName = "speculars";
try {
texture = TextureLoader.getTexture("PNG", Class.class.getResourceAsStream("/assets/" + folderName + "/" + fileName + ".png"));
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
if(GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
float amount = Math.min(4f, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount);
} else {
System.err.println("Anisotropic filtering not supported.");
}
} catch (IOException e) {
System.err.println("Failed to load texture: " + "/assets/" + folderName + "/" + fileName + ".png");
}
int textureID = texture.getTextureID();
textures.add(textureID);
return textureID;
}
示例6: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(String fileName) {
Texture texture = null;
try {
texture = TextureLoader.getTexture("PNG", Class.class.getResourceAsStream("/res/textures/" + fileName + ".png"));
} catch (Exception e) {
e.printStackTrace();
}
textures.add(texture.getTextureID());
return texture.getTextureID();
}
示例7: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(boolean root, String directory, String file, float bias) {
Texture texture = null;
if (!file.toLowerCase().endsWith(".png")) file += ".png";
try {
String path = directory + "/" + file;
if (!root) path = "assets/" + path;
texture = TextureLoader.getTexture("PNG", net.gogo98901.util.Loader.getResourceAsStream(path));
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, bias);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
if (directory != "fonts") {
if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
if (Config.anisotropic.get()) {
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0F);
float amount = Math.min(4F, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount);
} else {
Log.info("GL: Anisotropic filtering disabled by config");
}
} else {
Log.warn("GL: Anisotropic filtering not supported");
}
}
} catch (IOException e) {
Log.warn("Could not read texture '" + file + "'");
Log.stackTrace(e);
}
textures.add(texture.getTextureID());
return texture.getTextureID();
}
示例8: loadTexture
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public int loadTexture(BufferedImage bi) {
Texture texture = null;
try {
texture = BufferedImageUtil.getTexture("opencv", bi);
} catch (IOException e) {
e.printStackTrace();
}
int textureID = texture.getTextureID();
textures.add(textureID);
return textureID;
}