本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}