io.github.mwttg.pixelartillery2d.graphic.VertexArrayObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pixel-artillery-2d Show documentation
Show all versions of pixel-artillery-2d Show documentation
A library for 2D OpenGL and OpenAL support based on LWJGL 3
The newest version!
package io.github.mwttg.pixelartillery2d.graphic;
import org.lwjgl.opengl.GL41;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final class VertexArrayObject {
private static final Logger LOG = LoggerFactory.getLogger(VertexArrayObject.class);
private VertexArrayObject() {}
static int create(final int vertexVboId, final int textureVboId) {
final var id = GL41.glGenVertexArrays();
OpenGlCleanUp.addVertexArrayObjectId(id);
GL41.glBindVertexArray(id);
GL41.glBindBuffer(GL41.GL_ARRAY_BUFFER, vertexVboId);
GL41.glVertexAttribPointer(0, 3, GL41.GL_FLOAT, false, 0, 0);
GL41.glBindBuffer(GL41.GL_ARRAY_BUFFER, textureVboId);
GL41.glVertexAttribPointer(1, 2, GL41.GL_FLOAT, false, 0, 0);
GL41.glEnableVertexAttribArray(0); // vertices
GL41.glEnableVertexAttribArray(1); // texture coordinates
LOG.debug("create VertexArrayObject with id='{}'", id);
return id;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy