/** * @param array * @see com.jogamp.opengl.GL2ES2#glVertexAttribPointer(com.jogamp.opengl.GLArrayData) */ public void glVertexAttribPointer(GLArrayData array) { try{delegate.glVertexAttribPointer(array);} catch(GLException e){glException(e); throw e;} } /**
/** * @param indx * @param size * @param type * @param normalized * @param stride * @param ptr_buffer_offset * @see com.jogamp.opengl.GL2ES2#glVertexAttribPointer(int, int, int, boolean, int, long) */ public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, long ptr_buffer_offset) { try{delegate.glVertexAttribPointer(indx, size, type, normalized, stride, ptr_buffer_offset);} catch(GLException e){glException(e); throw e;} } /**
@Override public void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, long offset) { GLContext.getCurrentGL().getGL3().glVertexAttribPointer(index, size, type, normalized, stride, offset); } }
@Override public void createVertexAttribute(int glVertexArray, int target, int glBufferView, int attributeLocation, int size, int type, int stride, int offset) { gl.glBindVertexArray(glVertexArray); gl.glBindBuffer(target, glBufferView); gl.glVertexAttribPointer( attributeLocation, size, type, false, stride, offset); gl.glEnableVertexAttribArray(attributeLocation); }
/** * Draws this glMesh. * * @param vertexPosition vertex position handle */ void draw(int vertexPosition, int colorPosition) { vertices.bind(); indices.bind(); // first we store the vertex coordinates gl.glVertexAttribPointer(vertexPosition, 3/*(x,y,z)*/, GL_FLOAT, false, 7 * GLBuffers.SIZEOF_FLOAT, 0); // colors are added after the vertex coordinates gl.glVertexAttribPointer(colorPosition, 4/*(r,g,b,a)*/, GL_FLOAT, false, 7 * GLBuffers.SIZEOF_FLOAT, 3 * GLBuffers.SIZEOF_FLOAT); gl.glDrawElements(GL_TRIANGLES, indices.numElements(), GL_UNSIGNED_INT, 0); vertices.release(); indices.release(); }
@Override public Void call() throws Exception { final GL3 gl = gpu.getGl(); gl.glGenBuffers(1, ib); ib.clear(); dummyBufferID = ib.get(); gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, dummyBufferID); gl.glBufferData(GL3.GL_ARRAY_BUFFER, 1, null, GL3.GL_STATIC_DRAW); gl.glEnableVertexAttribArray(0); gl.glVertexAttribPointer(0, 1, GL3.GL_BYTE, false, 0, 0); gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0); return null; } });//end task0
/** * Draws this glMesh. * * @param vertexPosition vertex position handle */ void draw(int vertexPosition) { vertices.bind(); indices.bind(); gl.glVertexAttribPointer(vertexPosition, 3, GL_FLOAT, false, 3 * GLBuffers.SIZEOF_FLOAT, 0); gl.glDrawElements(GL_TRIANGLES, indices.numElements(), GL_UNSIGNED_INT, 0); vertices.release(); indices.release(); }
mGL.getGL3().glEnableVertexAttribArray(0); mGL.getGL3() .glVertexAttribPointer(0, 3, GL.GL_FLOAT, false, 0, 0); mGL.getGL3().glEnableVertexAttribArray(1); mGL.getGL3() .glVertexAttribPointer(1, 3, GL.GL_FLOAT, false, 0, 0); mGL.getGL3().glEnableVertexAttribArray(2); mGL.getGL3() .glVertexAttribPointer(2, 2, GL.GL_FLOAT, false, 0, 0);
public void updateNormals(FloatBuffer pNormalBuffer) { if (!isDynamic()) throw new UnsupportedOperationException("Cannot update non dynamic buffers!"); getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[1]); getGL().getGL3().glEnableVertexAttribArray(1); getGL().glBufferSubData(GL.GL_ARRAY_BUFFER, 0, pNormalBuffer.limit() * (Float.SIZE / Byte.SIZE), pNormalBuffer); getGL().getGL3().glVertexAttribPointer(1, mGeometrySize, GL.GL_FLOAT, false, 0, 0); getGL().getGL3().glBindVertexArray(0); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); }
: GL.GL_STATIC_DRAW); getGL().getGL3().glVertexAttribPointer(mVertexBuffers.length - 1, pBufferGeometrySize, GL.GL_FLOAT,
g.glVertexAttribPointer( position_attrib, 3, g.glVertexAttribPointer( color_attrib, 3,
public void addVertexAttributeArray(final GLVertexAttributeArray pGLVertexAttributeArray, final FloatBuffer pFloatBuffer) { bind(); final GLAttribute lAttribute = pGLVertexAttributeArray.getAttribute(); pGLVertexAttributeArray.bind(); final int lElementsPerIndex = pGLVertexAttributeArray.getElementsPerIndex(); mNumberOfIndices = pFloatBuffer.remaining() / lElementsPerIndex; getGL().glBufferData(GL.GL_ARRAY_BUFFER, pFloatBuffer.remaining() * (Float.SIZE / 8), pFloatBuffer, GL.GL_STATIC_DRAW); getGL().getGL3().glEnableVertexAttribArray(lAttribute.getIndex()); getGL().getGL3().glVertexAttribPointer(lAttribute.getIndex(), lElementsPerIndex, GL.GL_FLOAT, false, 0, 0); }
g.glVertexAttribPointer( position_attrib, 3, g.glVertexAttribPointer( color_attrib, 3,
public void updateVertices(FloatBuffer pVertexBuffer) { mStoredPrimitiveCount = pVertexBuffer.remaining() / mGeometrySize; if (!isDynamic()) throw new UnsupportedOperationException("Cannot update non dynamic buffers!"); getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[0]); getGL().getGL3().glEnableVertexAttribArray(0); getGL().glBufferData(GL.GL_ARRAY_BUFFER, pVertexBuffer.limit() * (Float.SIZE / Byte.SIZE), pVertexBuffer, isDynamic() ? GL.GL_DYNAMIC_DRAW : GL.GL_STATIC_DRAW); getGL().getGL3().glVertexAttribPointer(0, mGeometrySize, GL.GL_FLOAT, false, 0, 0); getGL().getGL3().glBindVertexArray(0); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); }
public void setTextureCoordsAndCreateBuffer(FloatBuffer pTextureCoordsBuffer) { getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[2]); getGL().getGL3().glEnableVertexAttribArray(2); getGL().glBufferData(GL.GL_ARRAY_BUFFER, pTextureCoordsBuffer.limit() * (Float.SIZE / Byte.SIZE), pTextureCoordsBuffer, isDynamic() ? GL.GL_DYNAMIC_DRAW : GL.GL_STATIC_DRAW); getGL().getGL3().glVertexAttribPointer(2, mTextureCoordSize, GL.GL_FLOAT, false, 0, 0); getGL().getGL3().glBindVertexArray(0); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); }
public void setNormalsAndCreateBuffer(FloatBuffer pNormalBuffer) { getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[1]); getGL().getGL3().glEnableVertexAttribArray(1); getGL().glBufferData(GL.GL_ARRAY_BUFFER, pNormalBuffer.limit() * (Float.SIZE / Byte.SIZE), pNormalBuffer, isDynamic() ? GL.GL_DYNAMIC_DRAW : GL.GL_STATIC_DRAW); getGL().getGL3().glVertexAttribPointer(1, mGeometrySize, GL.GL_FLOAT, false, 0, 0); getGL().getGL3().glBindVertexArray(0); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); }
g.glVertexAttribPointer( position_attrib, 3, g.glVertexAttribPointer( uv_attrib, 2,
public void setVerticesAndCreateBuffer(FloatBuffer pVertexBuffer) { mStoredPrimitiveCount = pVertexBuffer.remaining() / mGeometrySize; getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[0]); getGL().getGL3().glEnableVertexAttribArray(0); getGL().glBufferData(GL.GL_ARRAY_BUFFER, pVertexBuffer.limit() * (Float.SIZE / Byte.SIZE), pVertexBuffer, isDynamic() ? GL.GL_DYNAMIC_DRAW : GL.GL_STATIC_DRAW); getGL().getGL3().glVertexAttribPointer(0, mGeometrySize, GL.GL_FLOAT, false, 0, 0); getGL().getGL3().glBindVertexArray(0); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); }
public void updateTextureCoords(FloatBuffer pTextureCoordsBuffer) { if (!isDynamic()) throw new UnsupportedOperationException("Cannot update non dynamic buffers!"); getGL().getGL3().glBindVertexArray(mVertexArrayObject[0]); GLError.printGLErrors(getGL(), "1"); getGL().getGL3().glBindBuffer(GL.GL_ARRAY_BUFFER, mVertexBuffers[2]); GLError.printGLErrors(getGL(), "2"); getGL().getGL3().glEnableVertexAttribArray(2); GLError.printGLErrors(getGL(), "3"); getGL().glBufferSubData(GL.GL_ARRAY_BUFFER, 0, pTextureCoordsBuffer.limit() * (Float.SIZE / Byte.SIZE), pTextureCoordsBuffer); GLError.printGLErrors(getGL(), "4"); getGL().getGL3().glVertexAttribPointer(2, mTextureCoordSize, GL.GL_FLOAT, false, 0, 0); GLError.printGLErrors(getGL(), "5"); getGL().getGL3().glBindVertexArray(0); GLError.printGLErrors(getGL(), "6"); getGL().glBindBuffer(GL.GL_ARRAY_BUFFER, 0); GLError.printGLErrors(getGL(), "7"); }