Java Code Examples for com.jogamp.opengl.GL4#glDebugMessageInsert()
The following examples show how to use
com.jogamp.opengl.GL4#glDebugMessageInsert() .
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: Gl_430_multi_draw_indirect.java From jogl-samples with MIT License | 6 votes |
private void validate(GL4 gl4) { int[] status = {0}; gl4.glValidateProgramPipeline(pipelineName.get(0)); gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_VALIDATE_STATUS, status, 0); if (status[0] != GL_TRUE) { int[] lengthMax = {0}; gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_INFO_LOG_LENGTH, lengthMax, 0); int[] lengthQuery = {0}; byte[] infoLog = new byte[lengthMax[0] + 1]; gl4.glGetProgramPipelineInfoLog(pipelineName.get(0), infoLog.length, lengthQuery, 0, infoLog, 0); gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 76, GL_DEBUG_SEVERITY_LOW, lengthQuery[0], new String(infoLog).trim()); } }
Example 2
Source File: Gl_500_multi_draw_indirect_arb.java From jogl-samples with MIT License | 6 votes |
private void validate(GL4 gl4) { int[] status = {0}; gl4.glValidateProgramPipeline(pipelineName.get(0)); gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_VALIDATE_STATUS, status, 0); if (status[0] != GL_TRUE) { int[] lengthMax = {0}; gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_INFO_LOG_LENGTH, lengthMax, 0); IntBuffer lengthQuery = GLBuffers.newDirectIntBuffer(1); ByteBuffer infoLog = GLBuffers.newDirectByteBuffer(lengthMax[0] + 1); gl4.glGetProgramPipelineInfoLog(pipelineName.get(0), infoLog.capacity(), lengthQuery, infoLog); gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 76, GL_DEBUG_SEVERITY_LOW, lengthQuery.get(0), new String(infoLog.array()).trim()); } }
Example 3
Source File: Gl_500_multi_draw_indirect_count_arb.java From jogl-samples with MIT License | 6 votes |
private void validate(GL4 gl4) { int[] status = {0}; gl4.glValidateProgramPipeline(pipelineName[0]); gl4.glGetProgramPipelineiv(pipelineName[0], GL_VALIDATE_STATUS, status, 0); if (status[0] != GL_TRUE) { int[] lengthMax = {0}; gl4.glGetProgramPipelineiv(pipelineName[0], GL_INFO_LOG_LENGTH, lengthMax, 0); int[] lengthQuery = {0}; byte[] infoLog = new byte[lengthMax[0] + 1]; gl4.glGetProgramPipelineInfoLog(pipelineName[0], infoLog.length, lengthQuery, 0, infoLog, 0); gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 76, GL_DEBUG_SEVERITY_LOW, lengthQuery[0], new String(infoLog).trim()); } }
Example 4
Source File: Gl_440_multi_draw_indirect_id_arb.java From jogl-samples with MIT License | 6 votes |
private void validate(GL4 gl4) { int[] status = {0}; int[] lengthMax = {0}; gl4.glValidateProgramPipeline(pipelineName.get(0)); gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_VALIDATE_STATUS, status, 0); gl4.glGetProgramPipelineiv(pipelineName.get(0), GL_INFO_LOG_LENGTH, lengthMax, 0); int[] lengthQuery = {0}; byte[] infoLog = new byte[lengthMax[0] + 1]; gl4.glGetProgramPipelineInfoLog(pipelineName.get(0), infoLog.length, lengthQuery, 0, infoLog, 0); gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 76, GL_DEBUG_SEVERITY_LOW, lengthQuery[0], new String(infoLog).trim()); }
Example 5
Source File: Gl_430_debug.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; boolean validated = true; if (validated && gl4.isExtensionAvailable("GL_KHR_debug")) { validated = initDebug(gl4); } if (validated) { validated = initProgram(gl4); } if (validated) { validated = initBuffer(gl4); } if (validated) { validated = initVertexArray(gl4); } if (validated) { validated = initTexture(gl4); } gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "End initialization"); return validated; }
Example 6
Source File: Test.java From jogl-samples with MIT License | 5 votes |
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 7
Source File: Gl_430_debug.java From jogl-samples with MIT License | 4 votes |
private boolean initTexture(GL4 gl4) { boolean validated = true; try { jgli.Texture2d texture = new Texture2d(jgli.Load.load(TEXTURE_ROOT + "/" + TEXTURE_DIFFUSE)); gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); gl4.glGenTextures(1, textureName); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0)); gl4.glObjectLabel(GL_TEXTURE, textureName.get(0), -1, "Texture object".getBytes(), 0); gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Throwing an error on glTexParameteri"); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_GREEN); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_BLUE); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_LINEAR); // Generates an error GL_LINEAR instead of GL_ALPHA gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, texture.levels() - 1); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gl4.glTexStorage2D(GL_TEXTURE_2D, texture.levels(), GL_RGBA8, texture.dimensions(0)[0], texture.dimensions(0)[1]); for (int level = 0; level < texture.levels(); ++level) { gl4.glTexSubImage2D( GL_TEXTURE_2D, level, 0, 0, texture.dimensions(level)[0], texture.dimensions(level)[1], GL_BGR, GL_UNSIGNED_BYTE, texture.data(level)); } gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 4); } catch (IOException ex) { Logger.getLogger(Gl_430_debug.class.getName()).log(Level.SEVERE, null, ex); } return validated; }
Example 8
Source File: Gl_430_debug.java From jogl-samples with MIT License | 4 votes |
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 9
Source File: Gl_430_debug.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; gl4.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Frame".getBytes(), 0); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Throwing an error on glClearBufferfv"); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 0.5f).put(2, 0.0f).put(3, 1.0f)); // Add an error for testing: GL_TEXTURE_2D instead of GL_COLOR // gl4.glClearBufferfv(GL_TEXTURE_2D, 0, clearColor.put(0, 1.0f).put(1, 0.5f).put(2, 0.0f).put(3, 1.0f)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Throwing an error on glDrawElementsInstancedBaseVertexBaseInstance"); // Add an error for testing: GL_FLOAT instead of GL_UNSIGNED_SHORT // gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_FLOAT, 0, 1, 0, 0); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); gl4.glPopDebugGroup(); return true; }
Example 10
Source File: Gl_420_debug_output.java From jogl-samples with MIT License | 4 votes |
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; }