First time I have this problem
This is the last line executed in the init() https://github.com/elect86/NvGlSamples/blob/master/NvGlSamples/src/nvGlSamples/bindlessApp/BindlessApp.java#L200 and then display() is called Never faced this problem before Ps: using com.jogamp.opengl.util.Animator as animator |
There is an exception in the init() I wasnt catching before
|
This post was updated on .
The exception is this one
Caused by: com.jogamp.opengl.GLException: GL-Error 0x502 while creating mutable storage for buffer 1 of size 512 with data java.nio.DirectFloatBufferU[pos=0 lim=128 cap=128] at this point gl4.glNamedBufferData(vertexBuffer[0], Vertex.size() * vertices.size(), floatBuffer, GL4.GL_STATIC_DRAW); https://github.com/elect86/NvGlSamples/blob/master/NvGlSamples/src/nvGlSamples/bindlessApp/util/Mesh.java#L56-57 It is called from the init() when I try to create the allocate the geometry for the ground https://github.com/elect86/NvGlSamples/blob/master/NvGlSamples/src/nvGlSamples/bindlessApp/BindlessApp.java#L301 I have the object Vertex that takes 128 floats, I have 4 vertices, this means 512 Byte Everything seems right Anyway, error 0x502 is GL_INVALID_OPERATION and glNamedBufferData fires that only if: - GL_INVALID_OPERATION is generated by glNamedBufferData if buffer is not the name of an existing buffer object. - GL_INVALID_OPERATION is generated if the GL_BUFFER_IMMUTABLE_STORAGE flag of the buffer object is GL_TRUE. https://www.opengl.org/sdk/docs/man/html/glBufferData.xhtml Since buffer exist (!= 0, it is 1), it must be the second one *BUT* I cant query any GL_BUFFER_IMMUTABLE_STORAGE flag, since glGetBufferParameter requires a target which I didnt provide because of glNamedBufferData, https://www.opengl.org/sdk/docs/man/html/glGetBufferParameter.xhtml and if I look into https://github.com/sgothel/jogl/blob/master/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java#L217-220, if mutableUsage were false, I would have catched the internal error, which I didnt, so.. Any idea? PS: gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, vertexBuffer[0]); gl4.glBufferData(GL4.GL_ARRAY_BUFFER, Vertex.size() * vertices.size(), floatBuffer, GL4.GL_STATIC_DRAW); gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0); it works like a charm and I am sure I have GL 4.5 and DSA gl4.glGetString(GL4.GL_VERSION) 4.5.0 NVIDIA 347.88 gl4.isExtensionAvailable("GL_ARB_direct_state_access" true |
Solved, it seems if you bind the buffer before it doesnt complain
gl4.glNamedBufferData(vertexBuffer[0], Vertex.size() * vertices.size(), GLBuffers.newDirectFloatBuffer(verticesFA), GL4.GL_STATIC_DRAW); // *** INTERESTING *** // get the GPU pointer for the vertex buffer and make the vertex buffer // resident on the GPU gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, vertexBuffer[0]); gl4.glGetBufferParameterui64vNV(GL4.GL_ARRAY_BUFFER, GL4.GL_BUFFER_GPU_ADDRESS_NV, vertexBufferGPUPtr, 0); gl4.glGetBufferParameteriv(GL4.GL_ARRAY_BUFFER, GL4.GL_BUFFER_SIZE, vertexBufferSize, 0); gl4.glMakeBufferResidentNV(GL4.GL_ARRAY_BUFFER, GL4.GL_READ_ONLY); gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0); // *** INTERESTING *** // get the GPU pointer for the vertex buffer and make the vertex buffer // resident on the GPU gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, vertexBuffer[0]); gl4.glNamedBufferData(vertexBuffer[0], Vertex.size() * vertices.size(), GLBuffers.newDirectFloatBuffer(verticesArray), GL4.GL_STATIC_DRAW); gl4.glGetBufferParameterui64vNV(GL4.GL_ARRAY_BUFFER, GL4.GL_BUFFER_GPU_ADDRESS_NV, vertexBufferGPUPtr, 0); gl4.glGetBufferParameteriv(GL4.GL_ARRAY_BUFFER, GL4.GL_BUFFER_SIZE, vertexBufferSize, 0); gl4.glMakeBufferResidentNV(GL4.GL_ARRAY_BUFFER, GL4.GL_READ_ONLY); gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0); |
You can either move glNamedBufferData inside the binding or switching glGenBuffer to glCreateBuffer
|
Administrator
|
The purpose of glNamedBufferData consists in dropping the need of binding the buffer by passing the id. I don't get why you have to bind it anyway.
Julien Gouesse | Personal blog | Website
|
Exactly, anyway that was just a fix that make it run. The logic suggests the other way then, to switch glGenBuffer to glCreateBuffer |
Administrator
|
glCreateBuffer??
https://msdn.microsoft.com/en-us/library/ie/dn302382%28v=vs.85%29.aspx
Julien Gouesse | Personal blog | Website
|
Administrator
|
Ah sorry, I didnt get you meant to pay attention to the grammar |
Free forum by Nabble | Edit this page |