本文整理汇总了Java中com.jogamp.opengl.GL2.glGetProgramiv方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glGetProgramiv方法的具体用法?Java GL2.glGetProgramiv怎么用?Java GL2.glGetProgramiv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glGetProgramiv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printShaderLog
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void printShaderLog(GL2 gl) {
IntBuffer b = IntBuffer.allocate(8);
gl.glGetProgramiv(shaderprogram, GL2ES2.GL_INFO_LOG_LENGTH, b);
int logLength = b.get(0);
ByteBuffer bb = ByteBuffer.allocate(logLength);
b.clear();
gl.glGetProgramInfoLog(shaderprogram, logLength, b, bb);
String v = new String(bb.array(), java.nio.charset.StandardCharsets.UTF_8);
log.info(v);
}
示例2: createProgramFromBuffer
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
int createProgramFromBuffer(GL2 gl, String vProgram, String fProgram, HashMap<String,String> templates){
int program = 0;
vertexShader = initShader(gl, GL2.GL_VERTEX_SHADER, preProcessVertex( getSourceCode(vProgram), templates ));
fragmentShader = initShader(gl, GL2.GL_FRAGMENT_SHADER, preProcessFragment( getSourceCode(fProgram), templates ));
if (vertexShader != 0 && fragmentShader != 0) {
program = gl.glCreateProgram();
if (program != 0) {
gl.glAttachShader(program, vertexShader);
gl.glAttachShader(program, fragmentShader);
gl.glLinkProgram(program);
IntBuffer linkStatus = BufferUtils.createIntBuffer(1);
gl.glGetProgramiv(program, GL2.GL_LINK_STATUS, linkStatus);
if (linkStatus.get(0) != GL2.GL_TRUE) {
IntBuffer infoLen = BufferUtils.createIntBuffer(1);
gl.glGetProgramiv(program, GL2.GL_INFO_LOG_LENGTH, infoLen);
int length = infoLen.get();
if (length != 0) {
ByteBuffer buf = BufferUtils.createByteBuffer(length);
infoLen.flip();
gl.glGetProgramInfoLog(program, length, infoLen, buf);
byte[] b = new byte[length];
buf.get(b);
System.err.println("Could not link program: " + new String(b));
}
}
}
}
return program;
}