use of javax.media.opengl.GLException in project spaceships-demo by puniverse.
the class VAO method setVertex.
public void setVertex(GL3 gl, String attributeName, VBO vbo) {
vbo.bind(gl);
final int location = getLocation(gl, attributeName);
gl.glEnableVertexAttribArray(location);
if (vbo.getBuffer() instanceof FloatBuffer)
gl.glVertexAttribPointer(location, vbo.getComponents(), vbo.getComponentType(), vbo.isNormalized(), vbo.getStride(), 0);
else if (vbo.getBuffer() instanceof IntBuffer)
gl.glVertexAttribIPointer(location, vbo.getComponents(), vbo.getComponentType(), vbo.getStride(), 0);
else if (vbo.getBuffer() instanceof DoubleBuffer)
gl.glVertexAttribPointer(location, vbo.getComponents(), vbo.getComponentType(), false, vbo.getStride(), 0);
else
throw new GLException("Unrecognized buffer type: " + vbo.getBuffer().getClass().getName());
}
Aggregations