本文整理匯總了Java中net.minecraft.client.renderer.texture.ITextureObject.getGlTextureId方法的典型用法代碼示例。如果您正苦於以下問題:Java ITextureObject.getGlTextureId方法的具體用法?Java ITextureObject.getGlTextureId怎麽用?Java ITextureObject.getGlTextureId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.texture.ITextureObject
的用法示例。
在下文中一共展示了ITextureObject.getGlTextureId方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bindTexture
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public static void bindTexture(ITextureObject tex)
{
int i = tex.getGlTextureId();
if (tex instanceof TextureMap)
{
Shaders.atlasSizeX = ((TextureMap)tex).atlasWidth;
Shaders.atlasSizeY = ((TextureMap)tex).atlasHeight;
bindTextures(tex.getMultiTexID());
}
else
{
Shaders.atlasSizeX = 0;
Shaders.atlasSizeY = 0;
bindTextures(tex.getMultiTexID());
}
}
示例2: getTextureWidth
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public float getTextureWidth(TextureManager p_getTextureWidth_1_)
{
if (this.textureWidth <= 0)
{
if (this.textureLocation != null)
{
ITextureObject itextureobject = p_getTextureWidth_1_.getTexture(this.textureLocation);
int i = itextureobject.getGlTextureId();
int j = GlStateManager.getBoundTexture();
GlStateManager.bindTexture(i);
this.textureWidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
GlStateManager.bindTexture(j);
}
if (this.textureWidth <= 0)
{
this.textureWidth = 16;
}
}
return (float)this.textureWidth;
}
示例3: getTextureHeight
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public float getTextureHeight(TextureManager p_getTextureHeight_1_)
{
if (this.textureHeight <= 0)
{
if (this.textureLocation != null)
{
ITextureObject itextureobject = p_getTextureHeight_1_.getTexture(this.textureLocation);
int i = itextureobject.getGlTextureId();
int j = GlStateManager.getBoundTexture();
GlStateManager.bindTexture(i);
this.textureHeight = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
GlStateManager.bindTexture(j);
}
if (this.textureHeight <= 0)
{
this.textureHeight = 16;
}
}
return (float)this.textureHeight;
}
示例4: draw
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public void draw(int x, int y, int z) {
// We don't want to bind textures unless necessary
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
ITextureObject textureObject = manager.getTexture(texture);
int bound = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
if (textureObject == null || bound != textureObject.getGlTextureId()) {
manager.bindTexture(texture);
}
// ...and then we draw
SubTexture.drawTexturedModalRect(x, y, z, this.u, this.v, this.w, this.h);
}
示例5: updateTexture
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public boolean updateTexture()
{
if (this.dstTextId < 0)
{
ITextureObject itextureobject = TextureUtils.getTexture(this.dstTexLoc);
if (itextureobject == null)
{
return false;
}
this.dstTextId = itextureobject.getGlTextureId();
}
if (this.imageData == null)
{
this.imageData = GLAllocation.createDirectByteBuffer(this.srcData.length);
this.imageData.put(this.srcData);
this.srcData = null;
}
if (!this.nextFrame())
{
return false;
}
else
{
int k = this.frameWidth * this.frameHeight * 4;
int i = this.getActiveFrameIndex();
int j = k * i;
if (j + k > this.imageData.capacity())
{
return false;
}
else
{
this.imageData.position(j);
GlStateManager.bindTexture(this.dstTextId);
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, this.dstX, this.dstY, this.frameWidth, this.frameHeight, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData);
return true;
}
}
}
示例6: makeTextureAnimation
import net.minecraft.client.renderer.texture.ITextureObject; //導入方法依賴的package包/類
public static TextureAnimation makeTextureAnimation(Properties props, ResourceLocation propLoc)
{
String texFrom = props.getProperty("from");
String texTo = props.getProperty("to");
int x = Config.parseInt(props.getProperty("x"), -1);
int y = Config.parseInt(props.getProperty("y"), -1);
int width = Config.parseInt(props.getProperty("w"), -1);
int height = Config.parseInt(props.getProperty("h"), -1);
if (texFrom != null && texTo != null)
{
if (x >= 0 && y >= 0 && width >= 0 && height >= 0)
{
String basePath = TextureUtils.getBasePath(propLoc.getResourcePath());
texFrom = TextureUtils.fixResourcePath(texFrom, basePath);
texTo = TextureUtils.fixResourcePath(texTo, basePath);
byte[] imageBytes = getCustomTextureData(texFrom, width);
if (imageBytes == null)
{
Config.warn("TextureAnimation: Source texture not found: " + texTo);
return null;
}
else
{
ResourceLocation locTexTo = new ResourceLocation(texTo);
if (!Config.hasResource(locTexTo))
{
Config.warn("TextureAnimation: Target texture not found: " + texTo);
return null;
}
else
{
ITextureObject destTex = TextureUtils.getTexture(locTexTo);
if (destTex == null)
{
Config.warn("TextureAnimation: Target texture not found: " + locTexTo);
return null;
}
else
{
int destTexId = destTex.getGlTextureId();
TextureAnimation anim = new TextureAnimation(texFrom, imageBytes, texTo, destTexId, x, y, width, height, props, 1);
return anim;
}
}
}
}
else
{
Config.warn("TextureAnimation: Invalid coordinates");
return null;
}
}
else
{
Config.warn("TextureAnimation: Source or target texture not specified");
return null;
}
}