本文整理汇总了Java中org.lwjgl.opengl.GL20.glGetProgrami方法的典型用法代码示例。如果您正苦于以下问题:Java GL20.glGetProgrami方法的具体用法?Java GL20.glGetProgrami怎么用?Java GL20.glGetProgrami使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL20
的用法示例。
在下文中一共展示了GL20.glGetProgrami方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ShaderProgram
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
* @param shaders list of shaders to use in program
*/
public ShaderProgram(Shader ... shaders) {
id = GL20.glCreateProgram();
this.shaders = shaders;
// Attach shaders
for (Shader shader : shaders) {
GL20.glAttachShader(id, shader.id);
}
// Link
GL20.glLinkProgram(id);
if (GL20.glGetProgrami(id, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) {
throw new Error("Failed to link shader program.");
}
// Validate
GL20.glValidateProgram(id);
if (GL20.glGetProgrami(id, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) {
throw new Error("Failed to validate shader program.");
}
}
示例2: fetchAttribs
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private Attribute[] fetchAttribs()
{
int len = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_ATTRIBUTES);
int strlen = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);
Attribute[] attribs = new Attribute[len];
IntBuffer sizeBuffer = BufferUtils.createIntBuffer(1);
IntBuffer typeBuffer = BufferUtils.createIntBuffer(1);
for(int i = 0; i < attribs.length; ++i)
{
String name = GL20.glGetActiveAttrib(this.handle, i, strlen, sizeBuffer, typeBuffer);
int location = GL20.glGetAttribLocation(this.handle, name);
attribs[i] = new Attribute(this, name, typeBuffer.get(), location);
typeBuffer.flip();
}
return attribs;
}
示例3: fetchUniforms
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private Uniform[] fetchUniforms()
{
int len = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_UNIFORMS);
int strlen = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_UNIFORM_MAX_LENGTH);
Uniform[] uniforms = new Uniform[len];
IntBuffer sizeBuffer = BufferUtils.createIntBuffer(1);
IntBuffer typeBuffer = BufferUtils.createIntBuffer(1);
for(int i = 0; i < uniforms.length; ++i)
{
String name = GL20.glGetActiveUniform(this.handle, i, strlen, sizeBuffer, typeBuffer);
int location = GL20.glGetUniformLocation(this.handle, name);
uniforms[i] = new Uniform(this, name, typeBuffer.get(), location);
typeBuffer.flip();
}
return uniforms;
}
示例4: validate
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public Program validate()
{
GL20.glValidateProgram(this.handle);
int status = GL20.glGetProgrami(this.handle, GL20.GL_VALIDATE_STATUS);
if (status == GL11.GL_FALSE)
{
String infoLog = GL20.glGetProgramInfoLog(this.handle);
GL20.glDeleteProgram(this.handle);
this.handle = 0;
throw new GLException(infoLog);
}
return this;
}
示例5: link
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public Program link(Shader... shaders)
{
for (int i = 0; i < shaders.length; ++i)
{
GL20.glAttachShader(this.handle, shaders[i].handle());
}
GL20.glLinkProgram(this.handle);
int status = GL20.glGetProgrami(this.handle, GL20.GL_LINK_STATUS);
if (status == GL11.GL_FALSE)
{
String infolog = GL20.glGetProgramInfoLog(this.handle);
GL20.glDeleteProgram(this.handle);
this.handle = 0;
throw new GLException(infolog);
}
for (int i = 0; i < shaders.length; ++i)
{
GL20.glDetachShader(this.handle, shaders[i].handle());
}
this.attribs = this.fetchAttribs();
Uniform[] uniforms = this.fetchUniforms();
for(Uniform uniform : uniforms)
{
this.uniforms.put(uniform.name, uniform);
}
return this;
}
示例6: createShaderProgram
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public void createShaderProgram(RenderMethod renderMethod) {
shaderProgram = GL20.glCreateProgram();
vshader = createShader(vertexShader, GL20.GL_VERTEX_SHADER);
fshader = createShader(renderMethod.getFragmentShader(), GL20.GL_FRAGMENT_SHADER);
GL20.glAttachShader(shaderProgram, vshader);
GL20.glAttachShader(shaderProgram, fshader);
GL20.glBindAttribLocation(shaderProgram, 0, "vertex");
GL30.glBindFragDataLocation(shaderProgram, 0, "color");
GL20.glLinkProgram(shaderProgram);
int linked = GL20.glGetProgrami(shaderProgram, GL20.GL_LINK_STATUS);
String programLog = GL20.glGetProgramInfoLog(shaderProgram, GL20.glGetProgrami(shaderProgram, GL20.GL_INFO_LOG_LENGTH));
if (programLog.trim().length() > 0) {
System.err.println(programLog);
}
if (linked == 0) {
throw new AssertionError("Could not link program");
}
//init vbo
vbo = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6);
bb.put((byte) -1).put((byte) -1);
bb.put((byte) 1).put((byte) -1);
bb.put((byte) 1).put((byte) 1);
bb.put((byte) 1).put((byte) 1);
bb.put((byte) -1).put((byte) 1);
bb.put((byte) -1).put((byte) -1);
bb.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bb, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
示例7: createShaderProgram
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public void createShaderProgram() {
shaderProgram = GL20.glCreateProgram();
vShader = createShader(vertexShader, GL20.GL_VERTEX_SHADER);
fShader = createShader(fragmentShader, GL20.GL_FRAGMENT_SHADER);
GL20.glAttachShader(shaderProgram, vShader);
GL20.glAttachShader(shaderProgram, fShader);
GL20.glBindAttribLocation(shaderProgram, 0, "vertex");
GL30.glBindFragDataLocation(shaderProgram, 0, "color");
GL20.glLinkProgram(shaderProgram);
GL20.glDetachShader(shaderProgram, vShader);
GL20.glDetachShader(shaderProgram, fShader);
GL20.glDeleteShader(vShader);
vShader = 0;
GL20.glDeleteShader(fShader);
fShader = 0;
int linked = GL20.glGetProgrami(shaderProgram, GL20.GL_LINK_STATUS);
String programLog = GL20.glGetProgramInfoLog(shaderProgram, GL20.glGetProgrami(shaderProgram, GL20.GL_INFO_LOG_LENGTH));
if (programLog.trim().length() > 0) {
System.err.println(programLog);
}
if (linked == 0) {
throw new AssertionError("Could not link program");
}
//init vbo
vbo = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6);
bb.put((byte) -1).put((byte) -1);
bb.put((byte) 1).put((byte) -1);
bb.put((byte) 1).put((byte) 1);
bb.put((byte) 1).put((byte) 1);
bb.put((byte) -1).put((byte) 1);
bb.put((byte) -1).put((byte) -1);
bb.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bb, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
worldChunkSsbo = GL15.glGenBuffers();
chunkSsbo = GL15.glGenBuffers();
worldMetadataSsbo = GL15.glGenBuffers();
metadataSsbo = GL15.glGenBuffers();
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldChunkSsbo);
GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 2, worldChunkSsbo);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, chunkSsbo);
GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 3, chunkSsbo);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldMetadataSsbo);
GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 4, worldMetadataSsbo);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, metadataSsbo);
GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 5, metadataSsbo);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
示例8: glGetProgrami
import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public static int glGetProgrami(int program, int pname)
{
return arbShaders ? ARBShaderObjects.glGetObjectParameteriARB(program, pname) : GL20.glGetProgrami(program, pname);
}