Can you please tell me how you did the frustum culling?
I am trying to do it for last 4 hours, but i can’t make it work how it should.
Here is how i did the frustum faces loading:
public void update() {
FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16);
glGetFloat(GL_PROJECTION_MATRIX, projectionBuffer);
FloatBuffer modelBuffer = BufferUtils.createFloatBuffer(16);
glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
Matrix4f projectionMatrix = new Matrix4f();
projectionMatrix.load(projectionBuffer);
Matrix4f modelMatrix = new Matrix4f();
modelMatrix.load(modelBuffer);
Matrix4f viewMatrix = new Matrix4f();
Matrix4f.mul(projectionMatrix, modelMatrix, viewMatrix);
planes[0] = new Plane(viewMatrix.m30 + viewMatrix.m00, viewMatrix.m31 + viewMatrix.m01, viewMatrix.m32 + viewMatrix.m02, viewMatrix.m33 + viewMatrix.m03);
planes[1] = new Plane(viewMatrix.m30 - viewMatrix.m00, viewMatrix.m31 - viewMatrix.m01, viewMatrix.m32 - viewMatrix.m02, viewMatrix.m33 - viewMatrix.m03);
planes[2] = new Plane(viewMatrix.m30 + viewMatrix.m10, viewMatrix.m31 + viewMatrix.m11, viewMatrix.m32 + viewMatrix.m12, viewMatrix.m33 + viewMatrix.m13);
planes[3] = new Plane(viewMatrix.m30 - viewMatrix.m10, viewMatrix.m31 - viewMatrix.m11, viewMatrix.m32 - viewMatrix.m12, viewMatrix.m33 - viewMatrix.m13);
planes[4] = new Plane(viewMatrix.m30 + viewMatrix.m20, viewMatrix.m31 + viewMatrix.m21, viewMatrix.m32 + viewMatrix.m22, viewMatrix.m33 + viewMatrix.m23);
planes[5] = new Plane(viewMatrix.m30 - viewMatrix.m20, viewMatrix.m31 - viewMatrix.m21, viewMatrix.m32 - viewMatrix.m22, viewMatrix.m33 - viewMatrix.m23);
}