Hello,
before I start, I am new to LWJGL but I do have some experience with OpenGL in C++.
A long time ago I wrote a very basic game engine using OpenGL in C++ now I need to write that engine from C++ to Java, I decided to use LWJGL and I am able to create my window, load all the stuff that needs loading only when rendering I have the problem that nothing is rendering which is very frustrating. The only thing I can see is the blue clear color that I've set. Thing is, I have basically the same code on the other window in C++ and it works like a charm over there. After a bit of tinkering I found out that the only obvious way for the symptom to occur is to remove the code that sends matrices to the GPU, GL20.glUniformMatrix4fv, once I remove that call from my C++ engine I get the exact same result as in my Java attempt.
The thing is, I am calling that method with what I think are correct parameters, here's the snippet.
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
buffer = value.get(buffer);
buffer.flip();
GL20.glUniformMatrix4fv(getShaderData().getUniformMap().get(uniform).location, false, buffer);
value is a Matrix4f which I got from this math library
https://github.com/JOML-CI/JOMLThe other obvious ways why nothing is drawing would be that the model I upload is somehow not getting uploaded but I get no errors(even with glGetError()) and everything executes fine. This is my code for binding the buffers
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, meshData.getVertexArrayBuffers().get(MeshData.POSITIONS_VB));
FloatBuffer posBuffer = Util.vector3ListToFloatBuffer(model.getPositions());
posBuffer.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, posBuffer, GL15.GL_STATIC_DRAW);
GL20.glEnableVertexAttribArray(0);
GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, meshData.getVertexArrayBuffers().get(MeshData.TEXCOORD_VB));
FloatBuffer texBuffer = Util.vector2ListToFloatBuffer(model.getTexCoords());
texBuffer.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, texBuffer, GL15.GL_STATIC_DRAW);
GL20.glEnableVertexAttribArray(1);
GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, meshData.getVertexArrayBuffers().get(MeshData.NORMAL_VB));
FloatBuffer normalBuffer = Util.vector3ListToFloatBuffer(model.getNormals());
normalBuffer.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, normalBuffer, GL15.GL_STATIC_DRAW);
GL20.glEnableVertexAttribArray(2);
GL20.glVertexAttribPointer(2, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, meshData.getVertexArrayBuffers().get(MeshData.TANGENT_VB));
FloatBuffer tangentBuffer = Util.vector3ListToFloatBuffer(model.getTangents());
tangentBuffer.flip();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, tangentBuffer, GL15.GL_STATIC_DRAW);
GL20.glEnableVertexAttribArray(3);
GL20.glVertexAttribPointer(3, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, meshData.getVertexArrayBuffers().get(MeshData.INDEX_VB));
IntBuffer indicesBuffer = Util.intListToIntBuffer(model.getIndices());
indicesBuffer.flip();
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indicesBuffer, GL15.GL_STATIC_DRAW);
GL30.glBindVertexArray(0);
I really need to get this java engine going but my brain's done I am clueless.