本文整理匯總了Java中org.newdawn.slick.opengl.Texture.getTextureHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Texture.getTextureHeight方法的具體用法?Java Texture.getTextureHeight怎麽用?Java Texture.getTextureHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.opengl.Texture
的用法示例。
在下文中一共展示了Texture.getTextureHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
/**
* Setup.
*
* @param u the u
* @return the shader args
*/
public static ShaderArgs setup(FightUnit u) {
Unit unit = u.getUnit();
ShaderArgs args = new ShaderArgs();
if(unit.getTheClass().name.equals("Lord")) return args;
String c = unit.functionalClassName();
Texture t = palettes.get(c);
if(t == null) return args;
if(lookup.get(c) == null) return args;
int offset = lookup.get(c).indexOf(unit.name);
if(offset < 0) return args;
args.programName = "paletteSwap";
args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
GL13.glActiveTexture(GL13.GL_TEXTURE8);
t.bind();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
return args;
}
示例2: apply
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
/**
* Uploads the pixel data to the given texture at the specified position.
* This only needs to be called once, after the pixel data has changed.
*
* @param texture the texture to modify
* @param x the x position to place the pixel data on the texture
* @param y the y position to place the pixel data on the texture
*/
public void apply(Texture texture, int x, int y) {
if (x+width > texture.getTextureWidth() || y+height > texture.getTextureHeight())
throw new IndexOutOfBoundsException("pixel data won't fit in given texture");
position(length());
pixels.flip();
int glFmt = format.getOGLType();
final SGL GL = Renderer.get();
texture.bind();
GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, x, y, width, height,
glFmt, SGL.GL_UNSIGNED_BYTE, pixels);
}