com.jogamp.opengl.GL3

Here are the examples of the java api com.jogamp.opengl.GL3 taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

128 Examples 7

19 Source : JOCLSimpleGL3.java
with MIT License
from gpu

/**
 * Initialize the OpenGL VBO and the OpenCL VBO memory object
 *
 * @param gl The current GL object
 */
private void initVBOData(GL3 gl) {
    initVBO(gl);
    initVBOMem(gl);
    reInitVBOData = false;
}

19 Source : JOCLSimpleGL3.java
with MIT License
from gpu

/**
 * Initialize OpenCL. This will create the CL context for the GL
 * context of the given GL, as well as the command queue and
 * kernel.
 *
 * @param gl The GL object
 */
private void initCL(GL3 gl) {
    // The platform, device type and device number
    // that will be used
    final int platformIndex = 0;
    final long deviceType = CL_DEVICE_TYPE_GPU;
    final int deviceIndex = 0;
    // Enable exceptions and subsequently omit error checks in this sample
    CL.setExceptionsEnabled(true);
    // Obtain the number of platforms
    int[] numPlatformsArray = new int[1];
    clGetPlatformIDs(0, null, numPlatformsArray);
    int numPlatforms = numPlatformsArray[0];
    // Obtain a platform ID
    cl_platform_id[] platforms = new cl_platform_id[numPlatforms];
    clGetPlatformIDs(platforms.length, platforms, null);
    cl_platform_id platform = platforms[platformIndex];
    // Initialize the context properties
    cl_context_properties contextProperties = new cl_context_properties();
    contextProperties.addProperty(CL_CONTEXT_PLATFORM, platform);
    initContextProperties(contextProperties, gl);
    // Obtain the number of devices for the platform
    int[] numDevicesArray = new int[1];
    clGetDeviceIDs(platform, deviceType, 0, null, numDevicesArray);
    int numDevices = numDevicesArray[0];
    // Obtain a device ID
    cl_device_id[] devices = new cl_device_id[numDevices];
    clGetDeviceIDs(platform, deviceType, numDevices, devices, null);
    cl_device_id device = devices[deviceIndex];
    // Create a context for the selected device
    context = clCreateContext(contextProperties, 1, new cl_device_id[] { device }, null, null, null);
    // Create a command-queue for the selected device
    cl_queue_properties properties = new cl_queue_properties();
    commandQueue = clCreateCommandQueueWithProperties(context, device, properties, null);
    // Read the program source code and create the program
    String source = readFile("src/main/resources/kernels/simpleGL.cl");
    cl_program program = clCreateProgramWithSource(context, 1, new String[] { source }, null, null);
    clBuildProgram(program, 0, null, "-cl-mad-enable", null, null);
    // Create the kernel which computes the sine wave pattern
    kernel = clCreateKernel(program, "sine_wave", null);
    // Set the constant kernel arguments
    clSetKernelArg(kernel, 1, Sizeof.cl_uint, Pointer.to(new int[] { meshWidth }));
    clSetKernelArg(kernel, 2, Sizeof.cl_uint, Pointer.to(new int[] { meshHeight }));
}

19 Source : TriangleBatch.java
with Apache License 2.0
from constellation-app

public void dispose(final GL3 gl) {
    gl.glDeleteBuffers(4, bufferObjects, 0);
    gl.glDeleteVertexArrays(1, vertexArrayBufferObject, 0);
}

19 Source : TriangleBatch.java
with Apache License 2.0
from constellation-app

/**
 * Draw the triangles.
 * <p>
 * Make sure you call glEnableClientState for these arrays.
 *
 * @param gl the current OpenGL context.
 */
public void draw(final GL3 gl) {
    gl.glBindVertexArray(vertexArrayBufferObject[0]);
    gl.glDrawElements(GL3.GL_TRIANGLES, nNumIndexes, GL3.GL_UNSIGNED_SHORT, 0);
    // Unbind to anybody
    // Should this be just plain 0?
    // gl.glBindVertexArray(vertexArrayBufferObject[0]);
    gl.glBindVertexArray(0);
}

19 Source : TextureBuffer.java
with Apache License 2.0
from constellation-app

public void dispose(final GL3 gl) {
    gl.glDeleteTextures(1, textureName, 0);
    gl.glDeleteBuffers(1, bufferName, 0);
}

19 Source : TextureBuffer.java
with Apache License 2.0
from constellation-app

public void uniform(final GL3 gl, final int uniform, final int textureUnit) {
    // Bind the uniform to the texture unit.
    gl.glUniform1i(uniform, textureUnit);
    // Activate the texture unit.
    gl.glActiveTexture(GL3.GL_TEXTURE0 + textureUnit);
    // Bind the texture to the texture unit.
    gl.glBindTexture(GL3.GL_TEXTURE_BUFFER, textureName[0]);
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Set up a shared GLAutoDrawable to share textures across multiple
 * graphs/displays.
 * <p>
 * This makes use of the GLSharedContextSetter interface implemented by GLCanvas
 * et al. See the Javadoc for GLSharedContextSetter.
 * <p>
 * Note that the required texture names must be created before any other
 * drawables that share with this one are created, otherwise there is a grave
 * danger of name clashes, and that will just confuse everyone.
 *
 * TODO: {@link GlyphManagerFX} is broken, fix it or remove it.
 *
 * @author algol
 */
public final clreplaced SharedDrawable {

    private static GLAutoDrawable sharedDrawable = null;

    private static GL3 gl;

    private static int iconTextureName;

    private static boolean isInitialised = false;

    private static int simpleIconShader;

    private static int vertexIconShader;

    private static int lineShader;

    private static int lineLineShader;

    private static int loopShader;

    private static int nodeLabelShader;

    private static int connectionLabelShader;

    private static int blazeShader;

    private static int labelBackgroundGlyphPosition;

    private static GlyphManagerOpenGLController glyphTextureController;

    private static GlyphManager glyphManager;

    private static final String COULD_NOT_CONTEXT_CURRENT = "Could not make texture context current.";

    private static final String FRAG_COLOR = "fragColor";

    private static final Logger LOGGER = Logger.getLogger(SharedDrawable.clreplaced.getName());

    /**
     * No instances for anybody.
     */
    private SharedDrawable() {
    }

    private static void init() {
        if (isInitialised) {
            throw new RenderException("Can't initialise SharedDrawable more than once.");
        }
        // Use own display device.
        final boolean createNewDevice = true;
        sharedDrawable = GLDrawableFactory.getFactory(getGLProfile()).createDummyAutoDrawable(null, createNewDevice, getGLCapabilities(), null);
        // Trigger GLContext object creation and native realization.
        sharedDrawable.display();
        sharedDrawable.getContext().makeCurrent();
        try {
            sharedDrawable.setGL(new DebugGL3(sharedDrawable.getGL().getGL3()));
            // Create a shared texture object for the icon texture array.
            gl = sharedDrawable.getGL().getGL3();
            final int[] textureName = new int[1];
            gl.glGenTextures(1, textureName, 0);
            iconTextureName = textureName[0];
            // Create shared glyph coordinates and glyph image textures using a GlyphManager
            final boolean useMultiFonts = LabelFontsPreferenceKeys.useMultiFontLabels();
            if (useMultiFonts) {
                glyphManager = new GlyphManagerBI(LabelFontsPreferenceKeys.getFontInfo());
            } else {
                glyphManager = null;
            }
            glyphTextureController = new GlyphManagerOpenGLController(glyphManager);
            labelBackgroundGlyphPosition = glyphManager != null ? glyphManager.createBackgroundGlyph(0.5f) : 0;
            glyphTextureController.init(gl);
        } finally {
            sharedDrawable.getContext().release();
            isInitialised = true;
        }
    }

    public static void exportGlyphTextures(final File baseFile) {
        // Ensure that JavaFX is running
        try {
            Platform.startup(() -> {
            });
        } catch (final IllegalStateException ex) {
        /**
         * there isn't a way to tell whether the JavaFX platform is running
         * so we'll absorb this exception and move on.
         */
        }
        if (glyphManager != null) {
            Platform.runLater(() -> {
                String baseFileName = baseFile.getAbsolutePath();
                baseFileName = FilenameUtils.removeExtension(baseFileName);
                for (int page = 0; page < glyphManager.getGlyphPageCount(); page++) {
                    final File outputFile = new File(baseFileName + SeparatorConstants.UNDERSCORE + page + ".png");
                    try (final OutputStream out = new FileOutputStream(outputFile)) {
                        glyphManager.writeGlyphBuffer(page, out);
                    } catch (IOException ex) {
                        LOGGER.severe(ex.getLocalizedMessage());
                    }
                }
            });
        } else {
            LOGGER.log(Level.INFO, "No glyph textures to export");
        }
    }

    public static GLProfile getGLProfile() {
        final long startTime = System.currentTimeMillis();
        final GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        final long endTime = System.currentTimeMillis();
        LOGGER.log(Level.INFO, "Took {0} seconds to retrieve a GL3 profile", (endTime - startTime) / 1000);
        return glProfile;
    }

    /**
     * Return the capabilities required by the application.
     * <p>
     * This is returned here to ensure that all GL contexts have the same
     * capabilities.
     *
     * @return the capabilities required by the application.
     */
    public static GLCapabilities getGLCapabilities() {
        return new GLCapabilities(getGLProfile());
    }

    public static GLAutoDrawable getSharedAutoDrawable() {
        if (sharedDrawable == null) {
            init();
        }
        return sharedDrawable;
    }

    public static int getLabelBackgroundGlyphPosition() {
        return labelBackgroundGlyphPosition;
    }

    public static int getIconTextureName() {
        return iconTextureName;
    }

    public static GlyphManager getGlyphManager() {
        return glyphManager;
    }

    public static GlyphManagerOpenGLController getGlyphTextureController() {
        return glyphTextureController;
    }

    /**
     * Update the glyph textures on the shared GL context. The update will occur
     * via the GlyphManagerOpenGLController object, which checks its
     * GlyphManager to see if anything has changed, and if so, copies the
     * appropriate data to the open GL textures.
     *
     * @param glCurrent The GL context to switch back to after updating the
     * shared context.
     */
    public static void updateGlyphTextureController(final GL3 glCurrent) {
        if (Utilities.isMac()) {
            glyphTextureController.update(glCurrent);
        } else {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                glyphTextureController.update(gl);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
    }

    /**
     * The simple icon shader draws non-interactive icons.
     *
     * @param glCurrent the current OpenGL context.
     * @param colorTarget
     * @param colorShaderName
     * @param iconShaderName
     * @param iconTarget
     * @return the id of the icon shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getSimpleIconShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int iconTarget, final String iconShaderName) throws IOException {
        if (simpleIconShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.fs");
                simpleIconShader = GLTools.loadShaderSourceWithAttributes(gl, "SimpleIcon", vp, gp, fp, colorTarget, colorShaderName, iconTarget, iconShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return simpleIconShader;
    }

    /**
     * The vertex icon shader draws icons for vertices on the graph.
     *
     * @param glCurrent the current OpenGL context.
     * @param colorTarget
     * @param colorShaderName
     * @param iconShaderName
     * @param iconTarget
     * @return the id of the icon shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getVertexIconShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int iconTarget, final String iconShaderName) throws IOException {
        if (vertexIconShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.fs");
                vertexIconShader = GLTools.loadShaderSourceWithAttributes(gl, "VertexIcon", vp, gp, fp, colorTarget, colorShaderName, iconTarget, iconShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return vertexIconShader;
    }

    /**
     * Lines close to the camera are drawn as triangles to provide perspective.
     *
     * @param glCurrent the current OpenGL context.
     * @param colotTarget
     * @param colorShaderName
     * @param connectionInfoTarget
     * @param connectionInfoShaderName
     * @return the id of the line shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getLineShader(final GL3 glCurrent, final int colotTarget, final String colorShaderName, final int connectionInfoTarget, final String connectionInfoShaderName) throws IOException {
        if (lineShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.fs");
                lineShader = GLTools.loadShaderSourceWithAttributes(gl, "Line", vp, gp, fp, colotTarget, colorShaderName, connectionInfoTarget, connectionInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return lineShader;
    }

    /**
     * Lines further away don't look good as triangles (too many artifacts), so
     * distant lines are drawn as lines (which is more efficient anyway).
     *
     * @param glCurrent the current OpenGL context.
     * @param colotTarget
     * @param colorShaderName
     * @param connectionInfoTarget
     * @param connectionInfoShaderName
     * @return the id of the line shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getLineLineShader(final GL3 glCurrent, final int colotTarget, final String colorShaderName, final int connectionInfoTarget, final String connectionInfoShaderName) throws IOException {
        if (lineLineShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/LineLine.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/LineLine.fs");
                lineLineShader = GLTools.loadShaderSourceWithAttributes(gl, "LineLine", vp, gp, fp, colotTarget, colorShaderName, connectionInfoTarget, connectionInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return lineLineShader;
    }

    /**
     * Lines close to the camera are drawn as triangles to provide perspective.
     *
     * @param glCurrent the current OpenGL context.
     * @param colorTarget
     * @param colorShaderName
     * @param loopInfoTarget
     * @param loopInfoShaderName
     * @return the id of the loop shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getLoopShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int loopInfoTarget, final String loopInfoShaderName) throws IOException {
        if (loopShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.fs");
                loopShader = GLTools.loadShaderSourceWithAttributes(gl, "Loop", vp, gp, fp, colorTarget, colorShaderName, loopInfoTarget, loopInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return loopShader;
    }

    /**
     * Each character is drawn individually.
     *
     * @param glCurrent the current OpenGL context.
     * @param labelFloatsTarget The ID of the float buffer in the label batch
     * @param labelFloatsShaderName the name of the float buffer in the shader.
     * @param labelIntsTarget The ID of the int buffer in the label batch
     * @param labelIntsShaderName the name of the int buffer in the shader.
     * @return the id of the shader.
     * @throws IOException if an error occurs while reading the shader source.
     */
    public static int getNodeLabelShader(final GL3 glCurrent, final int labelFloatsTarget, final String labelFloatsShaderName, final int labelIntsTarget, final String labelIntsShaderName) throws IOException {
        if (nodeLabelShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/NodeLabel.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.fs");
                nodeLabelShader = GLTools.loadShaderSourceWithAttributes(gl, "Label", vp, gp, fp, labelFloatsTarget, labelFloatsShaderName, labelIntsTarget, labelIntsShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return nodeLabelShader;
    }

    /**
     * Each character is drawn individually.
     *
     * @param glCurrent the current OpenGL context.
     * @param labelFloatsTarget The ID of the float buffer in the label batch
     * @param labelFloatsShaderName the name of the float buffer in the shader
     * source.
     * @param labelIntsTarget The ID of the int buffer in the label batch
     * @param labelIntsShaderName the name of the int buffer in the shader
     * source.
     * @return the name of the shader.
     * @throws IOException if an error occurs while reader the shader source.
     */
    public static int getConnectionLabelShader(final GL3 glCurrent, final int labelFloatsTarget, final String labelFloatsShaderName, final int labelIntsTarget, final String labelIntsShaderName) throws IOException {
        if (connectionLabelShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/ConnectionLabel.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.fs");
                connectionLabelShader = GLTools.loadShaderSourceWithAttributes(gl, "Label", vp, gp, fp, labelFloatsTarget, labelFloatsShaderName, labelIntsTarget, labelIntsShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return connectionLabelShader;
    }

    /**
     * The blaze shader draws visual attachments to the nodes.
     *
     * @param glCurrent the current OpenGL context.
     * @param colorTarget
     * @param colorShaderName the name of the color buffer in the shader source.
     * @param blazeInfoTarget
     * @param blazeInfoShaderName the name of the int buffer in the shader
     * source.
     * @return the name of the shader.
     * @throws IOException if an error occurs while reader the shader source.
     */
    public static int getBlazeShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int blazeInfoTarget, final String blazeInfoShaderName) throws IOException {
        if (blazeShader == 0) {
            glCurrent.getContext().release();
            try {
                final int result = gl.getContext().makeCurrent();
                if (result == GLContext.CONTEXT_NOT_CURRENT) {
                    glCurrent.getContext().makeCurrent();
                    throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
                }
                final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.vs");
                final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.gs");
                final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.fs");
                blazeShader = GLTools.loadShaderSourceWithAttributes(gl, "Blaze", vp, gp, fp, colorTarget, colorShaderName, blazeInfoTarget, blazeInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
            } finally {
                gl.getContext().release();
                glCurrent.getContext().makeCurrent();
            }
        }
        return blazeShader;
    }
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * The blaze shader draws visual attachments to the nodes.
 *
 * @param glCurrent the current OpenGL context.
 * @param colorTarget
 * @param colorShaderName the name of the color buffer in the shader source.
 * @param blazeInfoTarget
 * @param blazeInfoShaderName the name of the int buffer in the shader
 * source.
 * @return the name of the shader.
 * @throws IOException if an error occurs while reader the shader source.
 */
public static int getBlazeShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int blazeInfoTarget, final String blazeInfoShaderName) throws IOException {
    if (blazeShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Blaze.fs");
            blazeShader = GLTools.loadShaderSourceWithAttributes(gl, "Blaze", vp, gp, fp, colorTarget, colorShaderName, blazeInfoTarget, blazeInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return blazeShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Each character is drawn individually.
 *
 * @param glCurrent the current OpenGL context.
 * @param labelFloatsTarget The ID of the float buffer in the label batch
 * @param labelFloatsShaderName the name of the float buffer in the shader.
 * @param labelIntsTarget The ID of the int buffer in the label batch
 * @param labelIntsShaderName the name of the int buffer in the shader.
 * @return the id of the shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getNodeLabelShader(final GL3 glCurrent, final int labelFloatsTarget, final String labelFloatsShaderName, final int labelIntsTarget, final String labelIntsShaderName) throws IOException {
    if (nodeLabelShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/NodeLabel.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.fs");
            nodeLabelShader = GLTools.loadShaderSourceWithAttributes(gl, "Label", vp, gp, fp, labelFloatsTarget, labelFloatsShaderName, labelIntsTarget, labelIntsShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return nodeLabelShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Update the glyph textures on the shared GL context. The update will occur
 * via the GlyphManagerOpenGLController object, which checks its
 * GlyphManager to see if anything has changed, and if so, copies the
 * appropriate data to the open GL textures.
 *
 * @param glCurrent The GL context to switch back to after updating the
 * shared context.
 */
public static void updateGlyphTextureController(final GL3 glCurrent) {
    if (Utilities.isMac()) {
        glyphTextureController.update(glCurrent);
    } else {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            glyphTextureController.update(gl);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * The vertex icon shader draws icons for vertices on the graph.
 *
 * @param glCurrent the current OpenGL context.
 * @param colorTarget
 * @param colorShaderName
 * @param iconShaderName
 * @param iconTarget
 * @return the id of the icon shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getVertexIconShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int iconTarget, final String iconShaderName) throws IOException {
    if (vertexIconShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/VertexIcon.fs");
            vertexIconShader = GLTools.loadShaderSourceWithAttributes(gl, "VertexIcon", vp, gp, fp, colorTarget, colorShaderName, iconTarget, iconShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return vertexIconShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Lines further away don't look good as triangles (too many artifacts), so
 * distant lines are drawn as lines (which is more efficient anyway).
 *
 * @param glCurrent the current OpenGL context.
 * @param colotTarget
 * @param colorShaderName
 * @param connectionInfoTarget
 * @param connectionInfoShaderName
 * @return the id of the line shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getLineLineShader(final GL3 glCurrent, final int colotTarget, final String colorShaderName, final int connectionInfoTarget, final String connectionInfoShaderName) throws IOException {
    if (lineLineShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/LineLine.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/LineLine.fs");
            lineLineShader = GLTools.loadShaderSourceWithAttributes(gl, "LineLine", vp, gp, fp, colotTarget, colorShaderName, connectionInfoTarget, connectionInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return lineLineShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Each character is drawn individually.
 *
 * @param glCurrent the current OpenGL context.
 * @param labelFloatsTarget The ID of the float buffer in the label batch
 * @param labelFloatsShaderName the name of the float buffer in the shader
 * source.
 * @param labelIntsTarget The ID of the int buffer in the label batch
 * @param labelIntsShaderName the name of the int buffer in the shader
 * source.
 * @return the name of the shader.
 * @throws IOException if an error occurs while reader the shader source.
 */
public static int getConnectionLabelShader(final GL3 glCurrent, final int labelFloatsTarget, final String labelFloatsShaderName, final int labelIntsTarget, final String labelIntsShaderName) throws IOException {
    if (connectionLabelShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/ConnectionLabel.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Label.fs");
            connectionLabelShader = GLTools.loadShaderSourceWithAttributes(gl, "Label", vp, gp, fp, labelFloatsTarget, labelFloatsShaderName, labelIntsTarget, labelIntsShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return connectionLabelShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Lines close to the camera are drawn as triangles to provide perspective.
 *
 * @param glCurrent the current OpenGL context.
 * @param colotTarget
 * @param colorShaderName
 * @param connectionInfoTarget
 * @param connectionInfoShaderName
 * @return the id of the line shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getLineShader(final GL3 glCurrent, final int colotTarget, final String colorShaderName, final int connectionInfoTarget, final String connectionInfoShaderName) throws IOException {
    if (lineShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Line.fs");
            lineShader = GLTools.loadShaderSourceWithAttributes(gl, "Line", vp, gp, fp, colotTarget, colorShaderName, connectionInfoTarget, connectionInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return lineShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * Lines close to the camera are drawn as triangles to provide perspective.
 *
 * @param glCurrent the current OpenGL context.
 * @param colorTarget
 * @param colorShaderName
 * @param loopInfoTarget
 * @param loopInfoShaderName
 * @return the id of the loop shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getLoopShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int loopInfoTarget, final String loopInfoShaderName) throws IOException {
    if (loopShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/Loop.fs");
            loopShader = GLTools.loadShaderSourceWithAttributes(gl, "Loop", vp, gp, fp, colorTarget, colorShaderName, loopInfoTarget, loopInfoShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return loopShader;
}

19 Source : SharedDrawable.java
with Apache License 2.0
from constellation-app

/**
 * The simple icon shader draws non-interactive icons.
 *
 * @param glCurrent the current OpenGL context.
 * @param colorTarget
 * @param colorShaderName
 * @param iconShaderName
 * @param iconTarget
 * @return the id of the icon shader.
 * @throws IOException if an error occurs while reading the shader source.
 */
public static int getSimpleIconShader(final GL3 glCurrent, final int colorTarget, final String colorShaderName, final int iconTarget, final String iconShaderName) throws IOException {
    if (simpleIconShader == 0) {
        glCurrent.getContext().release();
        try {
            final int result = gl.getContext().makeCurrent();
            if (result == GLContext.CONTEXT_NOT_CURRENT) {
                glCurrent.getContext().makeCurrent();
                throw new RenderException(COULD_NOT_CONTEXT_CURRENT);
            }
            final String vp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.vs");
            final String gp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.gs");
            final String fp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/SimpleIcon.fs");
            simpleIconShader = GLTools.loadShaderSourceWithAttributes(gl, "SimpleIcon", vp, gp, fp, colorTarget, colorShaderName, iconTarget, iconShaderName, ShaderManager.FRAG_BASE, FRAG_COLOR);
        } finally {
            gl.getContext().release();
            glCurrent.getContext().makeCurrent();
        }
    }
    return simpleIconShader;
}

19 Source : ShaderManager.java
with Apache License 2.0
from constellation-app

public void dispose(final GL3 gl) {
    if (stockShaders[0] != 0) {
        for (int i = 0; i < stockShaders.length; i++) {
            gl.glDeleteProgram(stockShaders[i]);
        }
        for (int i = 0; i < shaderTable.size(); i++) {
            gl.glDeleteProgram(shaderTable.get(i).shaderId);
        }
    }
}

19 Source : ShaderManager.java
with Apache License 2.0
from constellation-app

public void initialiseStockShaders(final GL3 gl) {
    stockShaders[SHADER_IDENreplacedY] = GLTools.loadShaderSourceWithAttributes(gl, "SHADER_IDENreplacedY", shaderMap.getProperty("SHADER_IDENreplacedY_VS"), null, shaderMap.getProperty("SHADER_IDENreplacedY_FS"), ATTRIBUTE_VERTEX, V_VERTEX, FRAG_BASE, OUT_COLOR);
    stockShaders[SHADER_FLAT] = GLTools.loadShaderSourceWithAttributes(gl, "SHADER_FLAT", shaderMap.getProperty("SHADER_FLAT_VS"), null, shaderMap.getProperty("SHADER_FLAT_FS"), ATTRIBUTE_VERTEX, V_VERTEX, FRAG_BASE, OUT_COLOR);
    stockShaders[SHADER_POINT_LIGHT_DIFF] = GLTools.loadShaderSourceWithAttributes(gl, "SHADER_POINT_LIGHT_DIFF", shaderMap.getProperty("SHADER_POINT_LIGHT_DIFF_VS"), null, shaderMap.getProperty("SHADER_POINT_LIGHT_DIFF_FS"), ATTRIBUTE_VERTEX, V_VERTEX, ATTRIBUTE_NORMAL, "vNormal", FRAG_BASE, OUT_COLOR);
    stockShaders[SHADER_TEXTURE_POINT_LIGHT_DIFF] = GLTools.loadShaderSourceWithAttributes(gl, "SHADER_TEXTURE_POINT_LIGHT_DIFF", shaderMap.getProperty("SHADER_TEXTURE_POINT_LIGHT_DIFF_VS"), null, shaderMap.getProperty("SHADER_TEXTURE_POINT_LIGHT_DIFF_FS"), ATTRIBUTE_VERTEX, V_VERTEX, ATTRIBUTE_NORMAL, "vNormal", ATTRIBUTE_TEXTURE0, "vTexCoord0", FRAG_BASE, OUT_COLOR);
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

private void updateGlyphs(GL3 gl) {
    final int width = glyphManager.getTextureWidth();
    final int height = glyphManager.getTextureHeight();
    final int pageCount = glyphManager.getGlyphPageCount();
    final int glyphCount = glyphManager.getGlyphCount();
    // If there have been new glyphs then some of then might be on the last page
    // buffered to the graphics card. We need to mark this last page as unbuffered
    // so that it gets buffered again.
    if (glyphCount > glyphsGlyphsBuffered && glyphsPagesBuffered > 0) {
        glyphsPagesBuffered--;
        glyphsPageBuffers.remove(glyphsPageBuffers.size() - 1);
    }
    glyphsGlyphsBuffered = glyphCount;
    if (pageCount > glyphsPageCapacity) {
        gl.glBindTexture(GL3.GL_TEXTURE_2D_ARRAY, glyphsTextureName[0]);
        gl.glTexImage3D(GL3.GL_TEXTURE_2D_ARRAY, 0, INTERNAL_FORMAT, width, height, pageCount, 0, EXTERNAL_FORMAT, GL3.GL_UNSIGNED_BYTE, null);
        glyphsPageCapacity = pageCount;
        glyphsPagesBuffered = 0;
    }
    while (glyphsPagesBuffered < pageCount) {
        final ByteBuffer pixelBuffer;
        if (glyphsPageBuffers.size() > glyphsPagesBuffered) {
            pixelBuffer = glyphsPageBuffers.get(glyphsPagesBuffered);
            pixelBuffer.rewind();
        } else {
            pixelBuffer = ByteBuffer.allocateDirect(width * height);
            glyphManager.readGlyphTexturePage(glyphsPagesBuffered, pixelBuffer);
            glyphsPageBuffers.add(pixelBuffer);
            pixelBuffer.flip();
        }
        gl.glBindTexture(GL3.GL_TEXTURE_2D_ARRAY, glyphsTextureName[0]);
        gl.glTexSubImage3D(GL3.GL_TEXTURE_2D_ARRAY, 0, 0, 0, glyphsPagesBuffered, width, height, 1, EXTERNAL_FORMAT, GL3.GL_UNSIGNED_BYTE, pixelBuffer);
        glyphsPagesBuffered++;
    }
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

public void bind(GL3 gl, int coordinatesUniformLocation, int coordinatesTextureUnit, int glyphsUniformLocation, int glyphsTexureUnit) {
    bindCoordinates(gl, coordinatesUniformLocation, coordinatesTextureUnit);
    bindGlyphs(gl, glyphsUniformLocation, glyphsTexureUnit);
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

private void bindGlyphs(GL3 gl, int uniformLocation, int textureUnit) {
    gl.glUniform1i(uniformLocation, textureUnit);
    gl.glActiveTexture(GL3.GL_TEXTURE0 + textureUnit);
    gl.glBindTexture(GL3.GL_TEXTURE_2D_ARRAY, glyphsTextureName[0]);
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

public void update(GL3 gl) {
    updateCoordinates(gl);
    updateGlyphs(gl);
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

private void bindCoordinates(GL3 gl, int uniformLocation, int textureUnit) {
    gl.glActiveTexture(GL3.GL_TEXTURE0 + textureUnit);
    gl.glBindTexture(GL3.GL_TEXTURE_BUFFER, coordinatesTextureName[0]);
    gl.glUniform1i(uniformLocation, textureUnit);
}

19 Source : GlyphManagerOpenGLController.java
with Apache License 2.0
from constellation-app

public void init(GL3 gl) {
    initCoordinates(gl);
    initGlyphs(gl);
}

19 Source : GLTools.java
with Apache License 2.0
from constellation-app

public static void loadShaderSource(final GL3 gl, final String shaderSrc, final int shader) {
    final String[] shaderParam = { shaderSrc };
    gl.glShaderSource(shader, 1, shaderParam, null, 0);
}

19 Source : GraphDisplayer.java
with Apache License 2.0
from constellation-app

@Override
public void dispose(GLAutoDrawable drawable) {
    final GL3 gl = drawable.getGL().getGL3();
    graphTextureBatch.dispose(gl);
}

19 Source : GraphDisplayer.java
with Apache License 2.0
from constellation-app

/**
 * Allows subclreplacedes to bind to extra shader locations in the
 * <code>display()</code> phase of the GL life-cycle for the purpose of
 * post-processing visual effects.
 *
 * @param gl The GL Context on which to bind shader locations.
 */
protected void bindShaderLocations(final GL3 gl) {
}

19 Source : GraphDisplayer.java
with Apache License 2.0
from constellation-app

/**
 * Allows subclreplacedes to create extra shader locations in the
 * <code>init()</code> phase of the GL life-cycle for the purpose of
 * post-processing visual effects.
 *
 * @param gl The GL Context on which to create shader locations.
 */
protected void createShaderLocations(final GL3 gl) {
}

19 Source : GraphDisplayer.java
with Apache License 2.0
from constellation-app

/**
 * Called by the {@link GraphRenderable} using this graph display to bind to
 * this displayer's buffers so that the graph is drawn onto these buffers
 * rather than directly onto the screen buffers.
 *
 * @param gl The GL Context on which to bind to this displayer's buffers.
 */
final void bindDisplayer(final GL3 gl) {
    gl.glBindFramebuffer(GL3.GL_DRAW_FRAMEBUFFER, graphFboName[0]);
    gl.glDrawBuffers(1, graphDrawBuffers, 0);
    if (needsResize) {
        gl.glActiveTexture(GL3.GL_TEXTURE0);
        gl.glBindTexture(GL3.GL_TEXTURE_2D, graphColorTextureName[0]);
        gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGB8, width, height, 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, null);
        gl.glActiveTexture(GL3.GL_TEXTURE0 + 1);
        gl.glBindTexture(GL3.GL_TEXTURE_2D, graphDepthTextureName[0]);
        gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_DEPTH_COMPONENT16, width, height, 0, GL3.GL_DEPTH_COMPONENT, GL.GL_FLOAT, null);
        needsResize = false;
    }
}

19 Source : GLRenderer.java
with Apache License 2.0
from constellation-app

@Override
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
    final GL3 gl = drawable.getGL().getGL3();
    // Windows-DPI-Scaling
    // 
    // If JOGL is ever fixed or another solution is found, either change
    // needsManualDPIScaling to return false (so there is effectively no
    // DPI scaling here) or remove the scaled height and width below.
    float dpiScaleX = 1.0f;
    float dpiScaleY = 1.0f;
    if (GLTools.needsManualDPIScaling()) {
        dpiScaleX = (float) ((Graphics2D) (parent.canvas).getGraphics()).getTransform().getScaleX();
        dpiScaleY = (float) ((Graphics2D) (parent.canvas).getGraphics()).getTransform().getScaleY();
    }
    // These need to be final as they are used in the lambda function below
    final int dpiScaledWidth = (int) (width * dpiScaleX);
    final int dpiScaledHeight = (int) (height * dpiScaleY);
    gl.glViewport(0, 0, dpiScaledWidth, dpiScaledHeight);
    // Create the projection matrix, and load it on the projection matrix stack.
    viewFrustum.setPerspective(FIELD_OF_VIEW, (float) dpiScaledWidth / (float) dpiScaledHeight, PERSPECTIVE_NEAR, PERSPECTIVE_FAR);
    projectionMatrix.set(viewFrustum.getProjectionMatrix());
    // A GLCanvas sets its minimum size to the preferred size when its redrawn. This means it will get bigger,
    // but never get smaller. Explicitly set the minimum size to get around this.
    ((Component) drawable).setMinimumSize(new Dimension(0, 0));
    renderables.forEach(renderable -> {
        renderable.reshape(x, y, dpiScaledWidth, dpiScaledHeight);
    });
    viewport[0] = x;
    viewport[1] = y;
    viewport[2] = dpiScaledWidth;
    viewport[3] = dpiScaledHeight;
}

19 Source : FPSRenderable.java
with Apache License 2.0
from constellation-app

@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.getLogger(GraphRenderable.clreplaced.getName()).log(Level.SEVERE, msg, ex);
        final InfoTextPanel itp = new InfoTextPanel(msg);
        final NotifyDescriptor.Message nd = new NotifyDescriptor.Message(itp, NotifyDescriptor.ERROR_MESSAGE);
        nd.setreplacedle("Shader Error");
        DialogDisplayer.getDefault().notify(nd);
    }
}

19 Source : FPSRenderable.java
with Apache License 2.0
from constellation-app

@Override
public void display(final GLAutoDrawable drawable, final Matrix44f pMatrix) {
    if (start == 0) {
        start = System.currentTimeMillis();
    }
    if ((System.currentTimeMillis() - start) >= 500) {
        fps = count_fps << 1;
        start = 0;
        count_fps = 0;
    }
    count_fps++;
    if (enabled) {
        final GL3 gl = drawable.getGL().getGL3();
        // extract and scale the rotation matrix from the mvp matrix
        // final Matrix44f rotationMatrix = new Matrix44f();
        // parent.getDisplayModelViewProjectionMatrix().getRotationMatrix(rotationMatrix);
        final Matrix44f scalingMatrix = new Matrix44f();
        scalingMatrix.makeScalingMatrix(pxScale, pyScale, 0);
        final Matrix44f srMatrix = new Matrix44f();
        srMatrix.multiply(scalingMatrix, IDENreplacedY_44F);
        // srMatrix.multiply(scalingMatrix, rotationMatrix);
        // build the fps matrix by translating the sr matrix
        final Matrix44f translationMatrix = new Matrix44f();
        translationMatrix.makeTranslationMatrix(bottomRightCorner.getX(), bottomRightCorner.getY(), bottomRightCorner.getZ());
        final Matrix44f fpsMatrix = new Matrix44f();
        fpsMatrix.multiply(translationMatrix, srMatrix);
        // disable depth so the fps counter is drawn on top
        gl.glDisable(GL3.GL_DEPTH_TEST);
        gl.glDepthMask(false);
        // draw the fps counter
        int[] fpsDigits = Long.toString(fps).chars().map(c -> c -= '0').toArray();
        if (fpsDigits.length < 2) {
            fpsDigits = new int[] { 0, fpsDigits[0] };
        }
        fpsBatcher.setPixelDensity(pixelDensity);
        fpsBatcher.setProjectionScale(pyScale);
        fpsBatcher.updateColors(ConstellationColor.YELLOW).run(gl);
        fpsBatcher.updateIcons(fpsDigits).run(gl);
        fpsBatcher.drawBatch(gl, CAMERA, fpsMatrix, pMatrix);
        // re-enable depth
        gl.glEnable(GL3.GL_DEPTH_TEST);
        gl.glDepthMask(true);
    }
}

19 Source : FPSRenderable.java
with Apache License 2.0
from constellation-app

@Override
public void dispose(final GLAutoDrawable drawable) {
    final GL3 gl = drawable.getGL().getGL3();
    fpsBatcher.disposeBatch().run(gl);
}

19 Source : NodeLabelBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getNodeLabelShader(gl, labelFloatsTarget, LABEL_FLOATS_SHADER_NAME, labelIntsTarget, LABEL_INTS_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderLabelBottomInfo = gl.glGetUniformLocation(shader, "labelBottomInfo");
    shaderLabelTopInfo = gl.glGetUniformLocation(shader, "labelTopInfo");
    shaderLocWidth = gl.glGetUniformLocation(shader, "widthScalingFactor");
    shaderLocHeight = gl.glGetUniformLocation(shader, "heightScalingFactor");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix");
    shaderBackgroundGlyphIndex = gl.glGetUniformLocation(shader, "backgroundGlyphIndex");
    shaderBackgroundColor = gl.glGetUniformLocation(shader, "backgroundColor");
    shaderHighlightColor = gl.glGetUniformLocation(shader, "highlightColor");
    shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture");
    shaderGlyphInfoTexture = gl.glGetUniformLocation(shader, "glyphInfoTexture");
    shaderGlyphImageTexture = gl.glGetUniformLocation(shader, "glyphImageTexture");
}

19 Source : LoopBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getLoopShader(gl, colorTarget, COLOR_SHADER_NAME, loopInfoTarget, LOOP_INFO_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderLocDrawHitTest = gl.glGetUniformLocation(shader, "drawHitTest");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix");
    shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture");
    shaderImagesTexture = gl.glGetUniformLocation(shader, "images");
}

19 Source : LineBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    lineShader = SharedDrawable.getLineShader(gl, colorTarget, COLOR_SHADER_NAME, connectionInfoTarget, CONNECTION_INFO_SHADER_NAME);
    lineLineShader = SharedDrawable.getLineLineShader(gl, colorTarget, COLOR_SHADER_NAME, connectionInfoTarget, CONNECTION_INFO_SHADER_NAME);
    lineShaderMVMatrix = gl.glGetUniformLocation(lineShader, "mvMatrix");
    lineShaderPMatrix = gl.glGetUniformLocation(lineShader, "pMatrix");
    lineShaderLocDrawHitTest = gl.glGetUniformLocation(lineShader, "drawHitTest");
    lineShaderVisibilityLow = gl.glGetUniformLocation(lineShader, "visibilityLow");
    lineShaderVisibilityHigh = gl.glGetUniformLocation(lineShader, "visibilityHigh");
    lineShaderMorphMix = gl.glGetUniformLocation(lineShader, "morphMix");
    lineShaderXyzTexture = gl.glGetUniformLocation(lineShader, "xyzTexture");
    lineShaderAlpha = gl.glGetUniformLocation(lineShader, "alpha");
    lineShaderHighlightColor = gl.glGetUniformLocation(lineShader, "highlightColor");
    lineShaderDirectionMotion = gl.glGetUniformLocation(lineShader, "directionMotion");
    lineLineShaderMVMatrix = gl.glGetUniformLocation(lineLineShader, "mvMatrix");
    lineLineShaderPMatrix = gl.glGetUniformLocation(lineLineShader, "pMatrix");
    lineLineShaderLocDrawHitTest = gl.glGetUniformLocation(lineLineShader, "drawHitTest");
    lineLineShaderVisibilityLow = gl.glGetUniformLocation(lineLineShader, "visibilityLow");
    lineLineShaderVisibilityHigh = gl.glGetUniformLocation(lineLineShader, "visibilityHigh");
    lineLineShaderMorphMix = gl.glGetUniformLocation(lineLineShader, "morphMix");
    lineLineShaderXyzTexture = gl.glGetUniformLocation(lineLineShader, "xyzTexture");
    lineLineShaderAlpha = gl.glGetUniformLocation(lineLineShader, "alpha");
    lineLineShaderHighlightColor = gl.glGetUniformLocation(lineLineShader, "highlightColor");
    lineLineShaderDirectionMotion = gl.glGetUniformLocation(lineLineShader, "directionMotion");
}

19 Source : IconBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getVertexIconShader(gl, colorTarget, COLOR_SHADER_NAME, iconTarget, ICON_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderLocDrawHitTest = gl.glGetUniformLocation(shader, "drawHitTest");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix");
    shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture");
    shaderImagesTexture = gl.glGetUniformLocation(shader, "images");
    shaderFlagsTexture = gl.glGetUniformLocation(shader, "flags");
    shaderHighlightColor = gl.glGetUniformLocation(shader, "highlightColor");
    shaderPixelDensity = gl.glGetUniformLocation(shader, "pixelDensity");
}

19 Source : FpsBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(final GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getSimpleIconShader(gl, colorTarget, COLOR_SHADER_NAME, iconTarget, ICON_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderImagesTexture = gl.glGetUniformLocation(shader, "images");
    shaderPixelDensity = gl.glGetUniformLocation(shader, "pixelDensity");
    shaderPScale = gl.glGetUniformLocation(shader, "pScale");
}

19 Source : ConnectionLabelBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getConnectionLabelShader(gl, floatsTarget, LABEL_FLOATS_SHADER_NAME, intsTarget, LABEL_INTS_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderLabelInfo = gl.glGetUniformLocation(shader, "labelInfo");
    shaderLocWidth = gl.glGetUniformLocation(shader, "widthScalingFactor");
    shaderLocHeight = gl.glGetUniformLocation(shader, "heightScalingFactor");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix");
    shaderBackgroundGlyphIndex = gl.glGetUniformLocation(shader, "backgroundGlyphIndex");
    shaderBackgroundColor = gl.glGetUniformLocation(shader, "backgroundColor");
    shaderHighlightColor = gl.glGetUniformLocation(shader, "highlightColor");
    shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture");
    shaderGlyphInfoTexture = gl.glGetUniformLocation(shader, "glyphInfoTexture");
    shaderGlyphImageTexture = gl.glGetUniformLocation(shader, "glyphImageTexture");
}

19 Source : BlazeBatcher.java
with Apache License 2.0
from constellation-app

@Override
public void createShader(GL3 gl) throws IOException {
    // Create the shader
    shader = SharedDrawable.getBlazeShader(gl, colorTarget, COLOR_SHADER_NAME, infoTarget, BLAZE_INFO_SHADER_NAME);
    // Set up uniform locations in the shader
    shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix");
    shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix");
    shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow");
    shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh");
    shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix");
    shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture");
    shaderImagesTexture = gl.glGetUniformLocation(shader, "images");
    shaderScale = gl.glGetUniformLocation(shader, "scale");
    shaderOpacity = gl.glGetUniformLocation(shader, "opacity");
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Disable all the vertex attribute arrays. The arrays should be enabled and
 * disabled each draw routine because this state is global and will affect
 * other draws.
 *
 * @param gl
 */
private void disableVertexAttribArrays(final GL3 gl) {
    for (int target = 0; target < numBuffers; target++) {
        try {
            getBufferName(target);
            gl.glDisableVertexAttribArray(target);
        } catch (RenderException ex) {
        }
    }
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Enable all the vertex attribute arrays. The arrays should be enabled and
 * disabled each draw routine because this state is global and will affect
 * other draws.
 *
 * @param gl
 */
private void enableVertexAttribArrays(final GL3 gl) {
    for (int target = 0; target < numBuffers; target++) {
        try {
            getBufferName(target);
            gl.glEnableVertexAttribArray(target);
        } catch (RenderException ex) {
        }
    }
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Buffer data from an explicitly provided buffer to a int buffer in this
 * batch, starting at the given offset.
 * <p>
 * If the target buffer doesn't yet exist on the GL context, it will be
 * created.
 *
 * @param gl The GL context on which to buffer the data.
 * @param target The int buffer to buffer to
 * @param buffer The data to buffer
 * @param offset
 */
public void buffer(final GL3 gl, final int target, final IntBuffer buffer, final int offset) {
    if (bufferIsFloat[target]) {
        throw new RenderException("Specified target is not a IntBuffer");
    }
    final int sizeLimit = bufferSizePerVertex[target] * numVertices;
    bufferSubData(gl, target, offset, sizeLimit, GLBuffers.SIZEOF_INT, buffer);
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Buffer data from an explicitly provided buffer to a float buffer in this
 * batch.
 * <p>
 * If the target buffer doesn't yet exist on the GL context, it will be
 * created.
 *
 * @param gl The GL context on which to buffer the data.
 * @param target The float buffer to buffer to
 * @param buffer The data to buffer
 */
public void buffer(final GL3 gl, final int target, final FloatBuffer buffer) {
    if (!bufferIsFloat[target]) {
        throw new RenderException(NOT_FLOATBUFFER);
    }
    final int size = bufferSizePerVertex[target] * numVertices;
    bufferData(gl, target, size, GLBuffers.SIZEOF_FLOAT, buffer);
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Draw the contents of this batch using the specified open GL context.
 * <p>
 * This replacedumes that all the relevant shader loading and binding of uniforms
 * has been done immediately prior to this call on the specified GL context.
 *
 * @param gl The GL context to draw the batch to.
 */
public void draw(final GL3 gl) {
    if (!finalised) {
        throw new RenderException("Attempting to draw this batch before first finalising it on the relevant open GL context.");
    }
    // glDrawArrays() throws INVALID_OPERATION on some video cards when using texture buffers.
    // Catch it here to avoid problems in other areas.
    try {
        gl.glBindVertexArray(vertexArrayObjectName[0]);
        enableVertexAttribArrays(gl);
        gl.glDrawArrays(primitiveType, 0, numVertices);
        disableVertexAttribArrays(gl);
        gl.glBindVertexArray(0);
    } catch (GLException ex) {
        LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
    }
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Buffer data from an explicitly provided buffer to an int buffer in this
 * batch.
 * <p>
 * If the target buffer doesn't yet exist on the GL context, it will be
 * created.
 *
 * @param gl The GL context on which to buffer the data.
 * @param target The int buffer to buffer to
 * @param buffer The data to buffer
 */
public void buffer(final GL3 gl, final int target, final IntBuffer buffer) {
    if (bufferIsFloat[target]) {
        throw new RenderException("Specified target is not an IntBuffer");
    }
    final int size = bufferSizePerVertex[target] * numVertices;
    bufferData(gl, target, size, GLBuffers.SIZEOF_INT, buffer);
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Dispose of this batch from the specified GL context.
 *
 * @param gl The GL context to dispose this batch from.
 */
public void dispose(final GL3 gl) {
    for (int i = 0; i < bufferNames.length; i++) {
        if (bufferNames[i].length != 0) {
            gl.glDeleteBuffers(1, bufferNames[i], 0);
            bufferNames[i] = new int[0];
        }
        if (bufferIsLocal[i]) {
            buffers[i] = null;
        }
    }
    numVertices = 0;
    if (finalised) {
        gl.glDeleteVertexArrays(1, vertexArrayObjectName, 0);
    }
    finalised = false;
    initialised = false;
}

19 Source : Batch.java
with Apache License 2.0
from constellation-app

/**
 * Buffer data from an explicitly provided buffer to a float buffer in this
 * batch, starting at the given offset.
 * <p>
 * If the target buffer doesn't yet exist on the GL context, it will be
 * created.
 *
 * @param gl The GL context on which to buffer the data.
 * @param target The float buffer to buffer to
 * @param buffer The data to buffer
 * @param offset the offset at which to begin the buffering operation.
 */
public void buffer(final GL3 gl, final int target, final FloatBuffer buffer, final int offset) {
    if (!bufferIsFloat[target]) {
        throw new RenderException(NOT_FLOATBUFFER);
    }
    final int sizeLimit = bufferSizePerVertex[target] * numVertices;
    bufferSubData(gl, target, offset, sizeLimit, GLBuffers.SIZEOF_FLOAT, buffer);
}

19 Source : AxesRenderable.java
with Apache License 2.0
from constellation-app

@Override
public void init(final GLAutoDrawable drawable) {
    final GL3 gl = drawable.getGL().getGL3();
    String axesVp = null;
    String axesGp = null;
    String axesFp = null;
    try {
        axesVp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/PreplacedThru.vs");
        axesGp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/PreplacedThruLine.gs");
        axesFp = GLTools.loadFile(GLVisualProcessor.clreplaced, "shaders/PreplacedThru.fs");
    } catch (IOException ex) {
        Logger.getLogger(AxesRenderable.clreplaced.getName()).log(Level.SEVERE, null, ex);
    }
    topRightCorner = new Vector3f();
    axesShader = GLTools.loadShaderSourceWithAttributes(gl, "PreplacedThru axes", axesVp, axesGp, axesFp, vertexTarget, "vertex", colorTarget, "color", ShaderManager.FRAG_BASE, "fragColor");
    axesShaderLocMVP = gl.glGetUniformLocation(axesShader, "mvpMatrix");
    axesBatch.initialise(NUMBER_OF_VERTICES);
    // x axis
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, ZERO_3F);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN, 0, 0);
    // arrow
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN - HEAD, HEAD, 0);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN, 0, 0);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN, 0, 0);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN - HEAD, -HEAD, 0);
    // X
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN + HEAD, HEAD, HEAD);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN + HEAD, -HEAD, -HEAD);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN + HEAD, HEAD, -HEAD);
    axesBatch.stage(colorTarget, XCOLOR);
    axesBatch.stage(vertexTarget, LEN + HEAD, -HEAD, HEAD);
    // y axis
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, ZERO_3F);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN, 0);
    // arrow
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN - HEAD, HEAD);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN, 0);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN, 0);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN - HEAD, -HEAD);
    // Y
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, -HEAD, LEN + HEAD, -HEAD);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN + HEAD, 0);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, HEAD, LEN + HEAD, -HEAD);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN + HEAD, 0);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN + HEAD, 0);
    axesBatch.stage(colorTarget, YCOLOR);
    axesBatch.stage(vertexTarget, 0, LEN + HEAD, HEAD);
    // z axis
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, ZERO_3F);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, 0, 0, LEN);
    // arrow
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, -HEAD, 0, LEN - HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, 0, 0, LEN);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, 0, 0, LEN);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, HEAD, 0, LEN - HEAD);
    // Z
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, -HEAD, HEAD, LEN + HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, HEAD, HEAD, LEN + HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, HEAD, HEAD, LEN + HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, -HEAD, -HEAD, LEN + HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, -HEAD, -HEAD, LEN + HEAD);
    axesBatch.stage(colorTarget, ZCOLOR);
    axesBatch.stage(vertexTarget, HEAD, -HEAD, LEN + HEAD);
    axesBatch.finalise(gl);
}

19 Source : AxesRenderable.java
with Apache License 2.0
from constellation-app

@Override
public void dispose(final GLAutoDrawable drawable) {
    final GL3 gl = drawable.getGL().getGL3();
    axesBatch.dispose(gl);
}

See More Examples