Java Code Examples for com.jogamp.opengl.GL4#glDebugMessageControl()

The following examples show how to use com.jogamp.opengl.GL4#glDebugMessageControl() . 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: Test.java    From jogl-samples with MIT License 5 votes vote down vote up
protected void logImplementationDependentLimit(GL4 gl4, int value, String string) {

        IntBuffer result = GLBuffers.newDirectIntBuffer(1);
        gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, GL_DEBUG_SEVERITY_LOW, 0, null, true);
        gl4.glGetIntegerv(value, result);
        String limit = string + ": " + result.get(0);
        if (gl4.isExtensionAvailable("GL_KHR_debug")) {
            gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 1, GL_DEBUG_SEVERITY_LOW,
                    limit.length(), limit);
        }
        gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, GL_DEBUG_SEVERITY_LOW, 0, null, false);
        BufferUtils.destroyDirectBuffer(result);
    }
 
Example 2
Source File: Gl_430_debug.java    From jogl-samples with MIT License 4 votes vote down vote up
private boolean initDebug(GL4 gl4) {

        boolean validated = true;

        gl4.glEnable(GL_DEBUG_OUTPUT);
        gl4.glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
        gl4.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, true);
//		gl4.glDebugMessageCallback(&test::debugOutput, this);

        gl4.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Message test: Begin".getBytes(), 0);

        int[] messageId = {4};
        gl4.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, FALSE);
        gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0, null, true);
        gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 1, messageId, 0, false);
        String message1 = "Message 1";
        gl4.glDebugMessageInsert(
                GL_DEBUG_SOURCE_APPLICATION,
                GL_DEBUG_TYPE_OTHER, 1,
                GL_DEBUG_SEVERITY_MEDIUM,
                message1.length(), message1);
        String message2 = "Message 2";
        gl4.glDebugMessageInsert(
                GL_DEBUG_SOURCE_THIRD_PARTY,
                GL_DEBUG_TYPE_OTHER, 2,
                GL_DEBUG_SEVERITY_MEDIUM,
                message2.length(), message2);
        gl4.glDebugMessageInsert(
                GL_DEBUG_SOURCE_APPLICATION,
                GL_DEBUG_TYPE_OTHER, 2,
                GL_DEBUG_SEVERITY_MEDIUM,
                -1, "Message 3");
        gl4.glDebugMessageInsert(
                GL_DEBUG_SOURCE_APPLICATION,
                GL_DEBUG_TYPE_OTHER, messageId[0],
                GL_DEBUG_SEVERITY_MEDIUM,
                -1, "Message 4");

        gl4.glPopDebugGroup();

        return validated;
    }
 
Example 3
Source File: Gl_420_debug_output.java    From jogl-samples with MIT License 4 votes vote down vote up
private boolean initDebugOutput(GL4 gl4) {

        if (useJoglUtils) {
            glWindow.getContext().enableGLDebugMessage(true);
            glWindow.getContext().setGLDebugSynchronous(true);
        } else {
//        gl4.glDisable(GL_DEBUG_OUTPUT);
            gl4.glEnable(GL_DEBUG_OUTPUT);
            gl4.glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
        }
        // from the constructor.
        System.out.println("isGLDebugEnabled " + glWindow.getContext().isGLDebugEnabled());
        // from enableGLDebugMessage()
        System.out.println("isGLDebugMessageEnabled " + glWindow.getContext().isGLDebugMessageEnabled());
        // from setGLDebugSynchronous
        System.out.println("isGLDebugSynchronous " + glWindow.getContext().isGLDebugSynchronous());

        glWindow.getContext().addGLDebugListener(new GlDebugOutput());

        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, 0, true);
        } else {
            gl4.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, 0, true);
        }

        IntBuffer messageId = GLBuffers.newDirectIntBuffer(new int[]{4});
        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
                    GL_DONT_CARE, 0, null, true);
            glWindow.getContext().glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
                    GL_DONT_CARE, 1, messageId, false);
        } else {
            gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0, null, 0, true);
            gl4.glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER,
                    GL_DONT_CARE, 1, messageId, false);
        }

        String message1 = "Message 1";
        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, 1,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    message1);
        } else {
            gl4.glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, 1,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    message1.length(), message1);
        }
        String message2 = "Message 2";
        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageInsert(
                    GL_DEBUG_SOURCE_THIRD_PARTY,
                    GL_DEBUG_TYPE_OTHER, 2,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    message2);
        } else {
            gl4.glDebugMessageInsert(
                    GL_DEBUG_SOURCE_THIRD_PARTY,
                    GL_DEBUG_TYPE_OTHER, 2,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    message2.length(), message2);
        }
        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, 2,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    "Message 3");
        } else {
            gl4.glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, 2,
                    GL_DEBUG_SEVERITY_MEDIUM,
                    -1, "Message 3");
        }
        if (useJoglUtils) {
            glWindow.getContext().glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, messageId.get(0),
                    GL_DEBUG_SEVERITY_MEDIUM,
                    "Message 4");
        } else {
            gl4.glDebugMessageInsert(
                    GL_DEBUG_SOURCE_APPLICATION,
                    GL_DEBUG_TYPE_OTHER, messageId.get(0),
                    GL_DEBUG_SEVERITY_MEDIUM,
                    -1, "Message 4");
        }

        BufferUtils.destroyDirectBuffer(messageId);

        return true;
    }