Login  Register

Re: Display() gets called before init() finishes

Posted by elect on Apr 20, 2015; 9:02am
URL: https://forum.jogamp.org/Display-gets-called-before-init-finishes-tp4034335p4034337.html

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