vbo exception

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

vbo exception

siddharth.cmdz
hi all,

Im trying to do basic texture mapping with jogl 2, 4.4 core profile. I created my vbos for the geometry and passing the vertex and texture coordinates but I'm getting a black color. I had the debug and trace enabled and I get this when I do glBufferData()

glBufferData(<int> 0x8892, <long> 72, <java.nio.Buffer> java.nio.HeapFloatBuffer[pos=0 lim=18 cap=18], <int> 0x88E4)GLDebugEvent[ id 0x20071
        type Warning: generic
        severity Unknown (0x826b)
        source GL API
        msg Buffer detailed info: Buffer object 5 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
        when 1416715967091
        source 4.4 (Core profile, arb, debug, ES2 compat, ES3 compat, FBO, hardware) - 4.4.0 - hash 0x57284c88]
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Unknown Source)
        at jogamp.opengl.GLDebugMessageHandler$StdErrGLDebugListener.messageSent(GLDebugMessageHandler.java:311)
        at jogamp.opengl.GLDebugMessageHandler.sendMessage(GLDebugMessageHandler.java:296)
        at jogamp.opengl.GLDebugMessageHandler.glDebugMessageARB(GLDebugMessageHandler.java:322)
        at jogamp.opengl.gl4.GL4bcImpl.dispatch_glBufferData(Native Method)
        at jogamp.opengl.gl4.GL4bcImpl.access$000(GL4bcImpl.java:29)
        at jogamp.opengl.gl4.GL4bcImpl$1.create(GL4bcImpl.java:36850)
        at jogamp.opengl.GLBufferObjectTracker.createBufferStorage(GLBufferObjectTracker.java:167)
        at jogamp.opengl.gl4.GL4bcImpl.glBufferData(GL4bcImpl.java:37383)
        at javax.media.opengl.DebugGL4bc.glBufferData(DebugGL4bc.java:938)
        at javax.media.opengl.TraceGL4bc.glBufferData(TraceGL4bc.java:741)
        at com.jogl.modern.workshop.core.Geometry4.init(Geometry4.java:133)
        at com.jogl.modern.drawables.SingleQuadDrawable.init(SingleQuadDrawable.java:62)
        at com.jogl.modern.workshop.core.Geometry4View.init(Geometry4View.java:181)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:639)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:661)
        at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1340)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1282)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1138)
        at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1368)
        at javax.media.opengl.Threading.invoke(Threading.java:223)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:522)
        at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:576)
        at sun.awt.RepaintArea.paintComponent(Unknown Source)
        at sun.awt.RepaintArea.paint(Unknown Source)
        at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$200(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

However, glGetError() returns 0. And the geometry displays fine and I have used similar block of code for normal attributes and they work fine. Below is the code for initializing the code for texture coordinates.. I cant figure out why jogl throws this exception and if it has any relation to not able to pass the texture coordinates to the shader?
     
int bytesPerFloat = Float.SIZE/Byte.SIZE;

      if(prim.getTexCoordBuffer() != null) {
        FloatBuffer texCoords = prim.getTexCoordBuffer();
        int numBytes = texCoords.capacity() * bytesPerFloat;
        gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, prim.getTexCoordBufferId());
        gl4.glBufferData(GL4.GL_ARRAY_BUFFER, numBytes, texCoords, GL4.GL_STATIC_DRAW);
        gl4.glVertexAttribPointer(TEXCOORD_ATTRIB_LOCATION, prim.getTexCoordSize(), GL4.GL_FLOAT, false, 0, 0);
        gl4.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0);
      }

Any help ?
Reply | Threaded
Open this post in threaded view
|

Re: vbo exception

gouessej
Administrator
Hi

Look at Elect86's modern JOGL examples.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: vbo exception

siddharth.cmdz
thanks will look into it..
Reply | Threaded
Open this post in threaded view
|

Re: vbo exception

siddharth.cmdz
thanks goussej...this is really an excellent set of tutorials.. is this link added in jogls tutorial/wiki page? If not, Im sure a lot of folks would benefit from this. As for my issue, it was a simple bug on my code, i didnt bind the texture properly. I used Cg before transitioning to glsl now, i could have sworn in Cg, you pass the texture object as the sampler uniform as opposed to the texture unit to be passed as the uniform. oh well...everything works now.
Reply | Threaded
Open this post in threaded view
|

Re: vbo exception

gouessej
Administrator
Hi

I added it into the wiki several months ago :) elect86 does a very good job, big kudos to him. I'm happy to learn that you fixed your bug.
Julien Gouesse | Personal blog | Website