@Override public void glDeleteVertexArrays(final IntBuffer arrays) { checkLimit(arrays); ARBVertexArrayObject.glDeleteVertexArrays(arrays); }
if (id == -1) { IntBuffer temp = intBuf1; glGenVertexArrays(temp); id = temp.get(0); mesh.setId(id); glBindVertexArray(id); context.boundVertexArray = id;
protected void bindFormat(int format) { if(format != lastFormat) { ARBVertexArrayObject.glBindVertexArray(format); lastFormat = format; } }
@Override public int genVertexArray() { return ARBVertexArrayObject.glGenVertexArrays(); }
GL_ARB_uniform_buffer_object = ext.contains("GL_ARB_uniform_buffer_object") && checkExtension("GL_ARB_uniform_buffer_object", ARBUniformBufferObject.isAvailable(this)); GL_ARB_vertex_array_bgra = ext.contains("GL_ARB_vertex_array_bgra"); GL_ARB_vertex_array_object = ext.contains("GL_ARB_vertex_array_object") && checkExtension("GL_ARB_vertex_array_object", ARBVertexArrayObject.isAvailable(this)); GL_ARB_vertex_attrib_64bit = ext.contains("GL_ARB_vertex_attrib_64bit") && checkExtension("GL_ARB_vertex_attrib_64bit", ARBVertexAttrib64Bit.isAvailable(this, ext)); GL_ARB_vertex_attrib_binding = ext.contains("GL_ARB_vertex_attrib_binding") && checkExtension("GL_ARB_vertex_attrib_binding", ARBVertexAttribBinding.isAvailable(this, ext));
@Override public void bindVertexArray(int id) { ARBVertexArrayObject.glBindVertexArray(id); }
@Override public int glGenVertexArrays() { return ARBVertexArrayObject.glGenVertexArrays(); }
@Override public void glDeleteVertexArrays(IntBuffer arrays) { checkLimit(arrays); ARBVertexArrayObject.glDeleteVertexArrays(arrays); }
@Override public void glBindVertexArray(int array) { ARBVertexArrayObject.glBindVertexArray(array); }
@Override GeometryHandle allocateVBO(EGeometryFormatType type, String name) { GeometryHandle geometry = super.allocateVBO(type, name); if (glcaps.GL_ARB_vertex_array_object && type.isSingleBuffer()) { geometry.setInternalFormatId(ARBVertexArrayObject.glGenVertexArrays()); bindFormat(geometry.getInternalFormatId()); specifyFormat(type); } if(type.isSingleBuffer()) { setObjectLabel(GL11.GL_VERTEX_ARRAY, geometry.getInternalFormatId(), name + "-vao"); } return geometry; }
@Override public void deleteVertexArray(int id) { ARBVertexArrayObject.glDeleteVertexArrays(id); }
private void renderMeshVertexArray(Mesh mesh, int lod, int count, VertexBuffer instanceData) { if (mesh.getId() == -1) { updateVertexArray(mesh, instanceData); } else { // TODO: Check if it was updated } if (context.boundVertexArray != mesh.getId()) { glBindVertexArray(mesh.getId()); context.boundVertexArray = mesh.getId(); } // IntMap<VertexBuffer> buffers = mesh.getBuffers(); VertexBuffer indices; if (mesh.getNumLodLevels() > 0) { indices = mesh.getLodLevel(lod); } else { indices = mesh.getBuffer(Type.Index); } if (indices != null) { drawTriangleList(indices, mesh, count); } else { drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount()); } clearVertexAttribs(); clearTextureUnits(); }
@Override public void drawTrianglesWithTextureColored(TextureHandle textureid, GeometryHandle shapeHandle, GeometryHandle colorHandle, int offset, int lines, int width, int stride, float x, float y) { bindTexture(textureid); if(backgroundVAO == -1) { if(glcaps.GL_ARB_vertex_array_object) { backgroundVAO = ARBVertexArrayObject.glGenVertexArrays(); bindFormat(backgroundVAO); } GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); bindGeometry(shapeHandle); GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 5 * 4, 0); GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 5 * 4, 3 * 4); bindGeometry(colorHandle); GL20.glVertexAttribPointer(2, 1, GL11.GL_FLOAT, false, 0, 0); setObjectLabel(GL11.GL_VERTEX_ARRAY, backgroundVAO, "background-vao"); setObjectLabel(KHRDebug.GL_BUFFER, shapeHandle.getInternalId(), "background-shape"); setObjectLabel(KHRDebug.GL_BUFFER, colorHandle.getInternalId(), "background-color"); } int starti = offset < 0 ? (int)Math.ceil(-offset/(float)stride) : 0; useProgram(prog_background); GL20.glUniform2f(prog_background.ufs[TRANS], x, y); bindFormat(backgroundVAO); for (int i = starti; i != lines; i++) { GL11.glDrawArrays(GL11.GL_TRIANGLES, (offset + stride * i) * 3, width * 3); } } private static final int PROJ = 0;
@Override public void glDeleteVertexArrays(IntBuffer arrays) { checkLimit(arrays); ARBVertexArrayObject.glDeleteVertexArrays(arrays); } }