Hi,
I'm currently playing a bit with Lwjgl while I'm learning Kotlin.
I'm experiencing some issues with the glNamedBufferStorage function. Whenever I try to fill the buffer using a FloatBuffer, nothing appears on the screen.
The problem is that it's only due to the fact I'm using a FloatBuffer, because when I use a FloatArray, it works as intended. Does anyone have an idea about what I'm missing ?
Here is the code where the problem appears, with the two version :
val a = FloatArray(data.size * componentCount)
val buffer: FloatBuffer = FloatBuffer.allocate(data.size * componentCount)
data.forEach {
buffer.put(it.x)
buffer.put(it.y)
buffer.put(it.z)
}
buffer.flip()
data.forEachIndexed() {
index, data ->
a[componentCount * index] = data.x
a[componentCount * index + 1] = data.y
a[componentCount * index + 2] = data.z
}
GL45.glNamedBufferStorage(id, buffer, flags) // This does not work
GL45.glNamedBufferStorage(id, a, flags) // This does work
If you need anything else, I'll give it.
Thanks