Login  Register

Re: How to use VBO?

Posted by Chaz on Jan 18, 2015; 7:08pm
URL: https://forum.jogamp.org/How-to-use-VBO-tp4033871p4033882.html

Thanks! Additional to your advice i replaced all VERTEX ARRAY to ARRAY BUFFER and now have this code

public void CreateBuffer(GL2 gl)
    {
        this.gl=gl;
        targetsBuffer = Buffers.newDirectIntBuffer(1);
        gl.glGenBuffers(1,targetsBuffer);
        gl.glBindBuffer(gl.GL_ARRAY_BUFFER,targetsBuffer.get(0));
        gl.glBufferData(GL.GL_ARRAY_BUFFER, Buffers.SIZEOF_FLOAT*fBuff.capacity(),fBuff,GL.GL_STATIC_DRAW);
    }

    @Override
    public void Draw() {
        gl.glEnableClientState(gl.GL_ARRAY_BUFFER);
        gl.glBindBuffer(GL.GL_ARRAY_BUFFER,targetsBuffer.get(0));
        gl.glDrawBuffer(targetsBuffer.get(0));
        gl.glDisableClientState(gl.GL_ARRAY_BUFFER);
    }

Now it compiles and runs good - but i don't see any mesh in my window =(