[Solved][LWJGL3]Can't get Frustum Culling to Work

I’ve tried lots of resources, such as the lighthouse3d tutorials (and more tutorials) and also Frustum classes that i’ve found on the internet. None of which have worked for me.

Note: before i show code i will note i am using JOML(Java OpenGl Math Library) for Vectors and Matrices, etc.

Here is the current Version that doesnt work(found it on internet and modified it): http://pastebin.com/CqtnXmag
Originally instead of:

Window.projectionMatrix.get(projectionBuffer);

it was:

glGetFloat(gl_projection_matrix, projectionbuffer)

and the same with the modelviewbuffer.

Window.projectionMatrix is created at the start of the window initialization class via:

public static Matrix4f updatePerspective(float fov, float aspect, float zNear, float zFar){
         Matrix4f matrix = new Matrix4f().identity();
		
         matrix.setPerspective(fov, aspect, zNear, zFar);
         perspective = matrix;
         return matrix;
}

and MatrixUtils.getmodelview() and matrixutils.getViewMatrix():

public static Matrix4f getViewMatrix(Camera camera){
		Vector3f cameraPos = camera.getTransform().getPosition();
		Quaternionf rotation = camera.getTransform().getRotation();
		
		Matrix4f viewMatrix = new Matrix4f().identity();
		//First do the rotation so camera rotates over its position
		viewMatrix.rotate((float)Math.toRadians(rotation.x), new Vector3f(1, 0, 0))
					.rotate((float)Math.toRadians(rotation.y), new Vector3f(0, 1, 0));
		//Then do the translation
		viewMatrix.translate(-cameraPos.x, -cameraPos.y, -cameraPos.z);
		return viewMatrix;
	}

	public static Matrix4f getModelViewMatrix(Transform transform, Matrix4f viewMatrix){
		Quaternionf rotation = transform.getRotation();
		Matrix4f modelViewMatrix = new Matrix4f().identity().translate(transform.getPosition())
						.rotateX((float)Math.toRadians(-rotation.x))
						.rotateY((float)Math.toRadians(-rotation.y))
						.rotateZ((float)Math.toRadians(-rotation.z))
						.scale(transform.getScale());
		Matrix4f viewCurr = new Matrix4f(viewMatrix);
		return viewCurr.mul(modelViewMatrix);
	}

Then (just to test) i am doing this every render call (for two cubes):

public void render(Window window, List<GameObject> renderList, Frustum frustum) {
		
		for(GameObject gameObject : renderList){
			frustum.calculateFrustum(camera);
			if(frustum.cubeInFrustum(gameObject.getTransform().getPosition().x, gameObject.getTransform().getPosition().y, gameObject.getTransform().getPosition().z, 1)){
				System.out.println("in frustum");
			}
			Matrix4f modelViewMatrix = MatrixUtils.getModelViewMatrix(gameObject.getTransform(), viewMatrix);
			shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
			shaderProgram.setUniform("material", gameObject.getMesh().getMaterial());
			gameObject.render(window, shaderProgram);
		}
	}

I don’t know whats wrong :frowning: