TextureAnimation.java 文件源码

java
阅读 15 收藏 0 点赞 0 评论 0

项目:BaseClient 作者:
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;
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号