hi @ all
i want to use glMapBuffer to update VBOs dynamicly. i want to use it for my map editor. the map contains of quads. each quad is rendererd as vbo.
i use these methods to map and unmap the buffer
public static int READ_ONLY = ARBVertexBufferObject.GL_READ_ONLY_ARB;
public static int WRITE_ONLY = ARBVertexBufferObject.GL_WRITE_ONLY_ARB;
public static int READ_WRITE = ARBVertexBufferObject.GL_READ_WRITE_ARB;
public static void mapBuffer(int id, int status, ByteBuffer oldBuffer) {
ARBVertexBufferObject.glMapBufferARB(id, status, oldBuffer);
}
public static void unmapBuffer(int id) {
ARBVertexBufferObject.glUnmapBufferARB(id);
}
and this code to map a vbo to the bytebuffer.
int size = 3 * getVBOSize() * getVBOSize();
ByteBuffer vertices = BufferUtils.createByteBuffer(size);
vertices.clear();
VBO.mapBuffer(selectedVBO, VBO.READ_WRITE, vertices);
vertices.rewind();
VBO.unmapBuffer(selectedVBO);
if i use it, i get the error
Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid enum (1280)
i thought in the vbo are float values from my vertices and no byte values. how can i map a float buffer or is it possible to calculate from byte to float or should i use byte values and why comes the error?
many questions and my bad english i hope you understand my problem and could help me
thanks for your help
theplayer