BufferOverflowException in the JSR-231 renderer

I get this exception when launching Lesson37 tests in the xith-tk (cel-shading) :

No Fragment Program support, skipping java.nio.BufferOverflowException at java.nio.Buffer.nextPutIndex(Buffer.java:419) at java.nio.DirectIntBufferU.put(DirectIntBufferU.java:245) at com.xith3d.render.jsr231.VertexProgramShaderPeer.bindShaderProgram(VertexProgramShaderPeer.java:110) at com.xith3d.render.jsr231.VertexProgramShaderPeer.setShaderProgramState(VertexProgramShaderPeer.java:169) at com.xith3d.render.jsr231.VertexProgramShaderPeer.shade(VertexProgramShaderPeer.java:183) at com.xith3d.render.CanvasPeerBase.setState(CanvasPeerBase.java:121) at com.xith3d.render.CanvasPeerBase.render(CanvasPeerBase.java:99) at com.xith3d.render.jsr231.CanvasPeerImpl.drawBin(CanvasPeerImpl.java:838) at com.xith3d.render.jsr231.CanvasPeerImpl.display(CanvasPeerImpl.java:1073) at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:77) at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:262) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:128) at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:279) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Do you (lilian ?) have an idea where it comes from and how to fix it ?

It seems in function “private void bindShaderProgram(GL gl, VertexProgram shaderProgram, CanvasPeer canvas)” in VertexProgramShaderPeer (line 109):

if ((spHandle != -1) && shaderProgram.isDirty()) {
// handleBuffer.rewind(); // – It is needed to rewind the buffer here.
handleBuffer.put(spHandle);
handleBuffer.rewind();

            .................

Hope it is helpful.

Actually I have no problem knowing which line is it but how to fix it…

  • bump * Lilian, any news ? Or do I have to read the whole JSR-231 myself ? ;D ;D

Sorry guy I didn’t read carefully your answer. I did as you suggested and it works perfectly ! Many thanks ! Now CellShading’s on the way… (And BTW thanks also to c_lilian).