Point + geometry with VBO index fails

If a Geometry has VBO with VBOInfo.setVBOIndexEnabled(true),

if fails to render when it is rendered with Point.

Test code is below.



When the statement "vbo.setVBOIndexEnabled(true);" is commented,

It works.



import com.jme.app.SimpleGame;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Point;
import com.jme.scene.VBOInfo;
import com.jme.scene.Spatial.CullHint;
import com.jme.scene.shape.Sphere;

public class TestVBO extends SimpleGame {

   @Override
   protected void simpleInitGame() {
      rootNode.setCullHint(CullHint.Never);
      Sphere sphere = new Sphere("sphere", 32, 32, 3);
      VBOInfo vbo = new VBOInfo(true);
      vbo.setVBOIndexEnabled(true);
      sphere.setVBOInfo(vbo);
      
      Vector3f[] vert = new Vector3f[] { new Vector3f(1, 5, 0), new Vector3f(-1, 5, 0)};
      Vector3f[] norm = new Vector3f[] { new Vector3f(0, 0, 1), new Vector3f(0, 0, 1)};
      ColorRGBA[] color = new ColorRGBA[] { new ColorRGBA(1, 1, 1, 1), new ColorRGBA(1, 1, 1, 1)};
      Point point = new Point("point", vert, norm, color, null);
      point.setPointSize(10);
      rootNode.attachChild(sphere);
      rootNode.attachChild(point);
   }
   
   public static void main(String[] args) {
      TestVBO test = new TestVBO();
      test.start();
   }
   
}

Your sphere has no BoundingBox, so it might get culled 'accidently'.

As rootNode has cull hint as CullHint.Never, sphere is not culled at all.



Anyway, I think this is the LWJGLRenderer bug.

I forgot to attach error log.


org.lwjgl.opengl.OpenGLException: Cannot use Buffers when Element Array Buffer Object is enabled
   at org.lwjgl.opengl.GLChecks.ensureElementVBOdisabled(GLChecks.java:102)
   at org.lwjgl.opengl.GL11.glDrawElements(GL11.java:1074)
   at com.jme.renderer.lwjgl.LWJGLRenderer.draw(LWJGLRenderer.java:866)
   at com.jme.scene.Point.draw(Point.java:266)
   at com.jme.scene.Spatial.onDraw(Spatial.java:412)
   at com.jme.scene.Node.draw(Node.java:520)
   at com.jme.scene.Spatial.onDraw(Spatial.java:412)
   at com.jme.renderer.lwjgl.LWJGLRenderer.draw(LWJGLRenderer.java:1216)
   at com.jme.app.SimpleGame.render(SimpleGame.java:81)
   at com.jme.app.BaseGame.start(BaseGame.java:87)
   at test.TestVBO.main(TestVBO.java:32)



mulova, can you test with JOGL in order to check if this bug is present in the JOGL renderer too please?

It's the same for JOGL.



javax.media.opengl.GLException: element vertex_buffer_object must be disabled to call this method
   at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:30667)
   at com.sun.opengl.impl.GLImpl.checkElementVBODisabled(GLImpl.java:30735)
   at com.sun.opengl.impl.GLImpl.glDrawElements(GLImpl.java:3858)
   at com.jme.renderer.jogl.JOGLRenderer.draw(JOGLRenderer.java:893)
   at com.jme.scene.Point.draw(Point.java:266)
   at com.jme.scene.Spatial.onDraw(Spatial.java:412)
   at com.jme.scene.Node.draw(Node.java:520)
   at com.jme.scene.Spatial.onDraw(Spatial.java:412)
   at com.jme.renderer.jogl.JOGLRenderer.draw(JOGLRenderer.java:1256)
   at com.jme.app.SimpleGame.render(SimpleGame.java:81)
   at com.jme.app.BaseGame.start(BaseGame.java:87)
   at jmetest.TestVBO.main(TestVBO.java:33)



As rootNode has cull hint as CullHint.Never


missed that sorry :)

see also http://www.jmonkeyengine.com/jmeforum/index.php?topic=10198.0



this is a still unfixed problem looking for a solution