本文整理汇总了Java中org.lwjgl.opengl.ARBShaderObjects.glCreateShaderObjectARB方法的典型用法代码示例。如果您正苦于以下问题:Java ARBShaderObjects.glCreateShaderObjectARB方法的具体用法?Java ARBShaderObjects.glCreateShaderObjectARB怎么用?Java ARBShaderObjects.glCreateShaderObjectARB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.ARBShaderObjects
的用法示例。
在下文中一共展示了ARBShaderObjects.glCreateShaderObjectARB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: glCreateShader
import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
/**
* creates a shader with the given mode and returns the GL id. params: mode
*/
public static int glCreateShader(int type)
{
return arbShaders ? ARBShaderObjects.glCreateShaderObjectARB(type) : GL20.glCreateShader(type);
}