本文整理汇总了Java中org.lwjgl.opengl.ARBShaderObjects.glCreateProgramObjectARB方法的典型用法代码示例。如果您正苦于以下问题:Java ARBShaderObjects.glCreateProgramObjectARB方法的具体用法?Java ARBShaderObjects.glCreateProgramObjectARB怎么用?Java ARBShaderObjects.glCreateProgramObjectARB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.ARBShaderObjects
的用法示例。
在下文中一共展示了ARBShaderObjects.glCreateProgramObjectARB方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的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;
}
示例2: Shader
import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
public Shader(Asset vertex, Asset fragment){
// Creates the vertex shader from the asset.
this.vertex = ShaderHelper.INSTANCE.create(vertex, ShaderType.VERTEX);
// Creates the fragment shader from the asset.
this.fragment = ShaderHelper.INSTANCE.create(fragment, ShaderType.FRAGMENT);
// Throws an exception if the shader programs didn't compile correctly.
if(this.vertex == 0 || this.fragment == 0)
throw new RuntimeException(String.format("Invalid shader compile. Vertex: %s, Fragment: %s, error: (%s)\n (%s).", vertex, fragment, getLogInfo(this.vertex), getLogInfo(this.fragment)));
// Creates the combined shader.
this.combined = ARBShaderObjects.glCreateProgramObjectARB();
// Attaches the vertex shader to the combined shader.
ARBShaderObjects.glAttachObjectARB(this.combined, this.vertex);
// Attaches the fragment shader to the combined shader.
ARBShaderObjects.glAttachObjectARB(this.combined, this.fragment);
// Links the combined shader.
ARBShaderObjects.glLinkProgramARB(this.combined);
// Validates the combined shader program to check for errors.
ARBShaderObjects.glValidateProgramARB(this.combined);
// Unbinds the shader.
unbind();
}
示例3: glCreateProgram
import org.lwjgl.opengl.ARBShaderObjects; //导入方法依赖的package包/类
public static int glCreateProgram()
{
return arbShaders ? ARBShaderObjects.glCreateProgramObjectARB() : GL20.glCreateProgram();
}