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


Java ARBShaderObjects.glShaderSourceARB方法代码示例

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


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

示例1: createShader

import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
public int createShader(String fileName, int type) {
	int shader = OpenGlHelper.glCreateShader(type);

	if (shader != 0) {
		ARBShaderObjects.glShaderSourceARB(shader, readFile(fileName));

		OpenGlHelper.glCompileShader(shader);
		OpenGlHelper.glCompileShader(shader);

		if (GL20.glGetShaderi(shader, OpenGlHelper.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
			throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
		}
	}

	return shader;
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:17,代码来源:ShaderHandler.java

示例2: parse

import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的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: glShaderSource

import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
public static void glShaderSource(int shaderIn, ByteBuffer string)
{
    if (arbShaders)
    {
        ARBShaderObjects.glShaderSourceARB(shaderIn, string);
    }
    else
    {
        GL20.glShaderSource(shaderIn, string);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:OpenGlHelper.java

示例4: create

import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
public int create(String shaderCode, ShaderType type){
    // The shader id.
    int shader = 0;
    try {
        // Create shader program
        shader = ARBShaderObjects.glCreateShaderObjectARB(type.getTypeId());

        // Returns if the shader isn't found.
        if(shader == 0)
            return 0;

        // Load and compile shader source.
        ARBShaderObjects.glShaderSourceARB(shader, shaderCode);
        ARBShaderObjects.glCompileShaderARB(shader);

        //Check for errors and throws an exception if one is found.
        if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
            System.out.println(GL20.glGetShaderInfoLog(shader, 500));
            System.err.println("Could not compile shader!");
            throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
        }

        // Return the shader id.
        return shader;
    } catch(Exception exception) {
        // Deletes the shader.
        ARBShaderObjects.glDeleteObjectARB(shader);

        // Prints the stack trace.
        exception.printStackTrace();
    }

    // Returns no shader.
    return 0;
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:36,代码来源:ShaderHelper.java


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