當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。