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


Java OpenGlHelper.glGetShaderi方法代码示例

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


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

示例1: create

import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public static int create(IResourceManager manager, @Nullable ResourceLocation vsh, @Nullable ResourceLocation fsh) {
	int vshId = 0, fshId = 0, program = 0;
	if(vsh != null) {
		vshId = parse(manager, vsh, VERTEX);
	}
	if(fsh != null) {
		fshId = parse(manager, fsh, FRAGMENT);
	}
	if(vsh != null || fsh != null) {
		program = ARBShaderObjects.glCreateProgramObjectARB();
	}
	if(vsh != null) {
		OpenGlHelper.glAttachShader(program, vshId);
	}
	if(fsh != null) {
		OpenGlHelper.glAttachShader(program, fshId);
	}
	OpenGlHelper.glLinkProgram(program);
	if(OpenGlHelper.glGetShaderi(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
		return 0;
	}
	if(OpenGlHelper.glGetShaderi(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
		return 0;
	}
	return program;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:27,代码来源:ShaderManager.java

示例2: parse

import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
private static int parse(IResourceManager manager, ResourceLocation location, int type) {
	int shader = OpenGlHelper.glCreateShader(type);
	try {
		InputStream inputStream = manager.getResource(location).getInputStream();
		String lines = IOUtils.readLines(inputStream, "UTF-8").stream()
				.collect(Collectors.joining("\n"));
		ARBShaderObjects.glShaderSourceARB(shader, lines);
		OpenGlHelper.glCompileShader(shader);
		inputStream.close();
		if(OpenGlHelper.glGetShaderi(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
			String info = OpenGlHelper.glGetProgramInfoLog(shader, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
			throw new RuntimeException("Error creating shader: " + info);
		}
	} catch(IOException e) {
		Solar.LOG.warn("[Shader Resource] Failed to load shader " + location.toString());
		OpenGlHelper.glDeleteShader(shader);
		e.printStackTrace();
	}
	return shader;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:21,代码来源:ShaderManager.java

示例3: loadShader

import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream());
        byte[] abyte = toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.glCreateShader(type.getShaderMode());
        OpenGlHelper.glShaderSource(i, bytebuffer);
        OpenGlHelper.glCompileShader(i);

        if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(type, i, filename);
        type.getLoadedShaders().put(filename, shaderloader);
    }

    return shaderloader;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:ShaderLoader.java

示例4: loadShader

import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        IResource iresource = resourceManager.getResource(resourcelocation);

        try
        {
            byte[] abyte = IOUtils.toByteArray((InputStream)(new BufferedInputStream(iresource.getInputStream())));
            ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
            bytebuffer.put(abyte);
            bytebuffer.position(0);
            int i = OpenGlHelper.glCreateShader(type.getShaderMode());
            OpenGlHelper.glShaderSource(i, bytebuffer);
            OpenGlHelper.glCompileShader(i);

            if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
            {
                String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
                JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
                jsonexception.setFilenameAndFlush(resourcelocation.getResourcePath());
                throw jsonexception;
            }

            shaderloader = new ShaderLoader(type, i, filename);
            type.getLoadedShaders().put(filename, shaderloader);
        }
        finally
        {
            IOUtils.closeQuietly((Closeable)iresource);
        }
    }

    return shaderloader;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:ShaderLoader.java


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