当前位置: 首页>>代码示例>>Java>>正文


Java TextureUtil.glGenTextures方法代码示例

本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureUtil.glGenTextures方法的典型用法代码示例。如果您正苦于以下问题:Java TextureUtil.glGenTextures方法的具体用法?Java TextureUtil.glGenTextures怎么用?Java TextureUtil.glGenTextures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.renderer.texture.TextureUtil的用法示例。


在下文中一共展示了TextureUtil.glGenTextures方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
    this.framebufferWidth = width;
    this.framebufferHeight = height;
    this.framebufferTextureWidth = width;
    this.framebufferTextureHeight = height;

    if (!OpenGlHelper.isFramebufferEnabled())
    {
        this.framebufferClear();
    }
    else
    {
        this.framebufferObject = OpenGlHelper.glGenFramebuffers();
        this.framebufferTexture = TextureUtil.glGenTextures();

        if (this.useDepth)
        {
            this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
        }

        this.setFramebufferFilter(9728);
        GlStateManager.bindTexture(this.framebufferTexture);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null));
        OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
        OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);

        if (this.useDepth)
        {
            OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
            OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
            OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
        }

        this.framebufferClear();
        this.unbindFramebufferTexture();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:39,代码来源:Framebuffer.java

示例2: createFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
    this.framebufferWidth = width;
    this.framebufferHeight = height;
    this.framebufferTextureWidth = width;
    this.framebufferTextureHeight = height;

    if (!OpenGlHelper.isFramebufferEnabled())
    {
        this.framebufferClear();
    }
    else
    {
        this.framebufferObject = OpenGlHelper.glGenFramebuffers();
        this.framebufferTexture = TextureUtil.glGenTextures();

        if (this.useDepth)
        {
            this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
        }

        this.setFramebufferFilter(9728);
        GlStateManager.bindTexture(this.framebufferTexture);
        GlStateManager.glTexImage2D(3553, 0, 32856, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, 6408, 5121, (IntBuffer)null);
        OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
        OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);

        if (this.useDepth)
        {
            OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
            OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
            OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
        }

        this.framebufferClear();
        this.unbindFramebufferTexture();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:Framebuffer.java

示例3: createFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public void createFramebuffer(int p_147605_1_, int p_147605_2_)
{
    this.framebufferWidth = p_147605_1_;
    this.framebufferHeight = p_147605_2_;
    this.framebufferTextureWidth = p_147605_1_;
    this.framebufferTextureHeight = p_147605_2_;

    if (!OpenGlHelper.isFramebufferEnabled())
    {
        this.framebufferClear();
    }
    else
    {
        this.framebufferObject = EXTFramebufferObject.glGenFramebuffersEXT();
        this.framebufferTexture = TextureUtil.glGenTextures();

        if (this.useDepth)
        {
            this.depthBuffer = EXTFramebufferObject.glGenRenderbuffersEXT();
        }

        this.setFramebufferFilter(9729);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.framebufferTexture);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
        EXTFramebufferObject.glBindFramebufferEXT(36160, this.framebufferObject);
        EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064, 3553, this.framebufferTexture, 0);

        if (this.useDepth)
        {
            EXTFramebufferObject.glBindRenderbufferEXT(36161, this.depthBuffer);
            EXTFramebufferObject.glRenderbufferStorageEXT(36161, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
            EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, 36096, 36161, this.depthBuffer);
        }

        this.framebufferClear();
        this.unbindFramebufferTexture();
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:39,代码来源:Framebuffer.java

示例4: PaintingSheet

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public PaintingSheet(int res){
	glTexId = TextureUtil.glGenTextures();
	this.resolution = res;
	
	int total = resolution * resolution / 256;
	for(int i = 0 ;i < total; i ++)icons.add(new PaintingIcon(this,i));
	
	TextureUtil.allocateTexture(glTexId, resolution, resolution);
}
 
开发者ID:hypercross,项目名称:minepainter,代码行数:10,代码来源:PaintingSheet.java

示例5: GXFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public GXFramebuffer(int w, int h)
{
	IntBuffer buffer = ByteBuffer.allocateDirect(1*4).order(ByteOrder.nativeOrder()).asIntBuffer();
	EXTFramebufferObject.glGenFramebuffersEXT( buffer ); // generate
	fbo = buffer.get();
	tex = TextureUtil.glGenTextures();
	// initialize texture
	GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex);
	GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, w, h, 0, GL11.GL_RGBA, GL11.GL_INT, (java.nio.ByteBuffer) null);
	GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
	width = w;
	height = h;
	
	EXTFramebufferObject.glBindFramebufferEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo);
	EXTFramebufferObject.glFramebufferTexture2DEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, tex, 0);
	
	GL11.glPushAttrib(GL11.GL_VIEWPORT_BIT);
	GL11.glViewport(0, 0, width, height);
	GL11.glClearColor(0, 0, 0, 255);
	GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
	GL11.glPopAttrib();
	
	int result = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);
	if (result!=EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT) {
		EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
		EXTFramebufferObject.glDeleteFramebuffersEXT(fbo);
		throw new RuntimeException("exception "+result+" when checking FBO status");
	}
	Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:31,代码来源:GXFramebuffer.java

示例6: addPlayerClothing

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public static void addPlayerClothing(PlayerClothing clothing) {
	players.put(clothing.player, clothing);
	try {
		if(clothing.glTextureID == -1) {
			clothing.glTextureID = TextureUtil.glGenTextures();
		}
		clothing.createClothingFile(clothingDir, clothingFileDir);
		BufferedImage image = ImageIO.read(clothing.getClothingFile(clothingFileDir));
		TextureUtil.uploadTextureImageAllocate(clothing.glTextureID, image, false, false);
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:AgeCraft,项目名称:AgeCraft-Old,代码行数:14,代码来源:PlayerClothingClient.java

示例7: updatePlayerClothing

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public static void updatePlayerClothing(String username) {
	if(players.containsKey(username)) {
		try {
			PlayerClothing clothing = players.get(username);
			if(clothing.glTextureID == -1) {
				clothing.glTextureID = TextureUtil.glGenTextures();
			}
			clothing.createClothingFile(clothingDir, clothingFileDir);
			BufferedImage image = ImageIO.read(clothing.getClothingFile(clothingFileDir));
			TextureUtil.uploadTextureImageAllocate(clothing.glTextureID, image, false, false);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:AgeCraft,项目名称:AgeCraft-Old,代码行数:16,代码来源:PlayerClothingClient.java

示例8: createFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public void createFramebuffer(int width, int height)
{
    this.framebufferWidth = width;
    this.framebufferHeight = height;
    this.framebufferTextureWidth = width;
    this.framebufferTextureHeight = height;

    if (!OpenGlHelper.isFramebufferEnabled())
    {
        this.framebufferClear();
    }
    else
    {
        this.framebufferObject = OpenGlHelper.glGenFramebuffers();
        this.framebufferTexture = TextureUtil.glGenTextures();

        if (this.useDepth)
        {
            this.depthBuffer = OpenGlHelper.glGenRenderbuffers();
        }

        this.setFramebufferFilter(9728);
        GlStateManager.bindTexture(this.framebufferTexture);
        GlStateManager.glTexImage2D(3553, 0, 32856, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, 6408, 5121, (IntBuffer)null);
        OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
        OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0);

        if (this.useDepth)
        {
            OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
            if (!this.stencilEnabled)
            {
            OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
            OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
            }
            else
            {
                OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight);
                OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
                OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer);
            }
        }

        this.framebufferClear();
        this.unbindFramebufferTexture();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:48,代码来源:Framebuffer.java

示例9: createFramebuffer

import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public void createFramebuffer(int p_147605_1_, int p_147605_2_)
{
    this.framebufferWidth = p_147605_1_;
    this.framebufferHeight = p_147605_2_;
    this.framebufferTextureWidth = p_147605_1_;
    this.framebufferTextureHeight = p_147605_2_;

    if (!OpenGlHelper.isFramebufferEnabled())
    {
        this.framebufferClear();
    }
    else
    {
        this.framebufferObject = OpenGlHelper.func_153165_e();
        this.framebufferTexture = TextureUtil.glGenTextures();

        if (this.useDepth)
        {
            this.depthBuffer = OpenGlHelper.func_153185_f();
        }

        this.setFramebufferFilter(9728);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.framebufferTexture);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
        OpenGlHelper.func_153171_g(OpenGlHelper.field_153198_e, this.framebufferObject);
        OpenGlHelper.func_153188_a(OpenGlHelper.field_153198_e, OpenGlHelper.field_153200_g, 3553, this.framebufferTexture, 0);

        if (this.useDepth)
        {
            OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.depthBuffer);
            if (net.minecraftforge.client.MinecraftForgeClient.getStencilBits() == 0)
            {
            OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight);
            OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.depthBuffer);
            }
            else
            {
                OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight);
                OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.depthBuffer);
                OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.depthBuffer);
            }
        }

        this.framebufferClear();
        this.unbindFramebufferTexture();
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:48,代码来源:Framebuffer.java


注:本文中的net.minecraft.client.renderer.texture.TextureUtil.glGenTextures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。