Screen got cut off by half on both height and width

Im making a small Engine using Box2D and GLFW. But for some reason, everything is rendered quarterly only. Which mean they are rendered at left-bottom side:

(The ball should be in the center of the screen, and when i move, the platform just got cut off when it reached the middle of the screen)

This is my reshape code:

void Reshape(GLFWwindow*, int w, int h)
	engine.width = w;
	engine.height = h > 0 ? h : 1;

	glViewport(0, 0, engine.width, engine.height);
	float aspect = float(engine.width) / float(engine.height);
	if (engine.width >= engine.height)
		glOrtho( * aspect +, * aspect +, +, +, -1.0, 1.0);
		glOrtho( +, +, / aspect +, / aspect +, -1.0, 1.0);

my camera class:

class Camera {
	float zoom = 5;
	Vector2 position = Vector2(0, 0);
	void Update(); // Basically call the Reshape function provided above^^^
	void SetPosition(Vector2 position) {
		this->position = position;

my set resize callback function:

glfwSetWindowSizeCallback(engine.gameWin, Reshape);

Please help me! Im so confused, it worked fine on Windows but not on MacOS.

This is probably because your MacOS has window scaling (retina or other high resolution display), so the Window size is not the same as the Framebuffer size.

You need to use the Framebuffer size callback to set your viewport rather than the window size.

It worked. Thank you!! :grin: