Java源码示例:org.lwjgl.opengl.OpenGLException

示例1
private static int createShader(ResourceLocation source, int type) {
	int shader = 0;
	try {
		shader = ShaderHelper.methods().glCreateShader(type);
		if (shader == 0) throw new OpenGLException("Error creating shader object");

		ShaderHelper.methods().glShaderSource(shader, readShaderSource(source));
		ShaderHelper.methods().glCompileShader(shader);
		if (ShaderHelper.methods().glGetShaderi(shader, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) throw new OpenGLException("Shader compile error: " + ShaderHelper.methods().getShaderLogInfo(shader));

		return shader;
	} catch (Throwable t) {
		ShaderHelper.methods().glDeleteShader(shader);
		throw t;
	}
}
 
示例2
protected boolean checkGLError() {
    try {
        Util.checkGLError();
    } catch (OpenGLException ex){
        listener.handleError("An OpenGL error has occurred!", ex);
    }
    // NOTE: Always return true since this is used in an "assert" statement
    return true;
}
 
示例3
private static String readShaderSource(ResourceLocation source) {
	try {
		final InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(source).getInputStream();
		final Iterator<String> lines = IOUtils.lineIterator(is, StandardCharsets.UTF_8);
		final StringBuilder out = new StringBuilder();
		Joiner.on('\n').appendTo(out, lines);
		return out.toString();
	} catch (IOException e) {
		throw new OpenGLException("Failed to read resource " + source, e);
	}

}
 
示例4
protected boolean checkGLError(){
    try {
        Util.checkGLError();
    } catch (OpenGLException ex){
        listener.handleError("An OpenGL error has occured!", ex);
    }
    // NOTE: Always return true since this is used in an "assert" statement
    return true;
}
 
示例5
protected boolean checkGLError(){
    try {
        Util.checkGLError();
    } catch (OpenGLException ex){
        listener.handleError("An OpenGL error has occured!", ex);
    }
    // NOTE: Always return true since this is used in an "assert" statement
    return true;
}