use of au.gov.asd.tac.constellation.visual.opengl.utilities.RenderException in project constellation by constellation-app.
the class GraphRenderable method init.
/**
* Initialise the batch store.
* <p>
* Only JOGL initialisation is done here to match the JOGL context.
* Everything here is independent of any particular graph.
*
* @param drawable GL drawable.
*/
@Override
public void init(final GLAutoDrawable drawable) {
final GL3 gl = drawable.getGL().getGL3();
// Each character is drawn individually.
try {
blazeBatcher.createShader(gl);
lineBatcher.createShader(gl);
loopBatcher.createShader(gl);
nodeLabelBatcher.createShader(gl);
connectionLabelBatcher.createShader(gl);
iconBatcher.createShader(gl);
} catch (final IOException | RenderException ex) {
// If we get here, a shader didn't compile. This obviously shouldn't happen in production,
// our shaders are static and read from built-in resource files (it happens a lot in
// development when we edit a shader, but that's OK). Since at least one shader is null,
// there will be subsequent NullPointerExceptions, but there's nothing we can do about that.
// Without shaders, we're dead in the water anyway.
final String msg = "This error may have occurred because your video card and/or driver is\n" + "incompatible with CONSTELLATION.\n\n" + "Please inform CONSTELLATION support, including the text of this message.\n\n" + ex.getMessage();
LOGGER.log(Level.SEVERE, msg, ex);
final InfoTextPanel itp = new InfoTextPanel(msg);
final NotifyDescriptor.Message nd = new NotifyDescriptor.Message(itp, NotifyDescriptor.ERROR_MESSAGE);
nd.setTitle("Shader Error");
DialogDisplayer.getDefault().notify(nd);
}
graphDisplayer.init(drawable);
GLTools.checkFramebufferStatus(gl, "gr-check");
parent.rebuild();
}
use of au.gov.asd.tac.constellation.visual.opengl.utilities.RenderException in project constellation by constellation-app.
the class Batch method connectFloatBuffer.
/**
* Connect to a finalised float buffer on a GL Context for the purpose of
* updating its values directly.
*
* @param gl The GLContext on which the buffer was finalised.
* @param target
* @return A FloatBuffer directly backed by data on the GL context.
*/
public FloatBuffer connectFloatBuffer(final GL3 gl, final int target) {
final int bufferName = getBufferName(target);
if (!bufferIsFloat[target]) {
throw new RenderException(NOT_FLOATBUFFER);
}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferName);
final ByteBuffer connectionBbuf = gl.glMapBuffer(GL.GL_ARRAY_BUFFER, GL2ES3.GL_READ_WRITE);
return connectionBbuf.order(ByteOrder.nativeOrder()).asFloatBuffer();
}
use of au.gov.asd.tac.constellation.visual.opengl.utilities.RenderException in project constellation by constellation-app.
the class Batch method getOrCreateBufferName.
private int getOrCreateBufferName(final GL3 gl, final int target) {
try {
if (bufferNames[target].length == 0) {
bufferNames[target] = new int[1];
gl.glGenBuffers(1, bufferNames[target], 0);
}
return bufferNames[target][0];
} catch (ArrayIndexOutOfBoundsException ex) {
throw new RenderException("Specified target doesn't exist.");
}
}
use of au.gov.asd.tac.constellation.visual.opengl.utilities.RenderException in project constellation by constellation-app.
the class Batch method connectIntBuffer.
/**
* Connect to a finalised int buffer on a GL Context for the purpose of
* updating its values directly.
*
* @param gl The GLContext on which the buffer was finalised.
* @param target
* @return An IntBuffer directly backed by data on the GL context.
*/
public IntBuffer connectIntBuffer(final GL3 gl, final int target) {
final int bufferName = getBufferName(target);
if (bufferIsFloat[target]) {
throw new RenderException("Specified target is not an IntBuffer");
}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferName);
final ByteBuffer connectionBbuf = gl.glMapBuffer(GL.GL_ARRAY_BUFFER, GL2ES3.GL_READ_WRITE);
return connectionBbuf.order(ByteOrder.nativeOrder()).asIntBuffer();
}
use of au.gov.asd.tac.constellation.visual.opengl.utilities.RenderException in project constellation by constellation-app.
the class FPSRenderable method init.
@Override
public void init(final GLAutoDrawable drawable) {
final GL3 gl = drawable.getGL().getGL3();
try {
fpsBatcher.createShader(gl);
fpsBatcher.createBatch(null).run(gl);
} catch (final IOException | RenderException ex) {
// If we get here, a shader didn't compile. This obviously shouldn't happen in production,
// our shaders are static and read from built-in resource files (it happens a lot in
// development when we edit a shader, but that's OK). Since at least one shader is null,
// there will be subsequent NullPointerExceptions, but there's nothing we can do about that.
// Without shaders, we're dead in the water anyway.
final String msg = "This error may have occurred because your video card and/or driver is\n" + "incompatible with CONSTELLATION.\n\n" + "Please inform CONSTELLATION support, including the text of this message.\n\n" + ex.getMessage();
LOGGER.log(Level.SEVERE, msg, ex);
final InfoTextPanel itp = new InfoTextPanel(msg);
final NotifyDescriptor.Message nd = new NotifyDescriptor.Message(itp, NotifyDescriptor.ERROR_MESSAGE);
nd.setTitle("Shader Error");
DialogDisplayer.getDefault().notify(nd);
}
}
Aggregations