org.lwjgl.opengl.OpenGLException Java Examples

The following examples show how to use org.lwjgl.opengl.OpenGLException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShaderProgramBuilder.java    From OpenModsLib with MIT License 6 votes vote down vote up
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;
	}
}
 
Example #2
Source File: LwjglAbstractDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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;
}
 
Example #3
Source File: ShaderProgramBuilder.java    From OpenModsLib with MIT License 5 votes vote down vote up
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);
	}

}
 
Example #4
Source File: LwjglOffscreenBuffer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #5
Source File: LwjglAbstractDisplay.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}