Rendering issue on OSX

Lillpeter

New member
Joined
Sep 17, 2017
Messages
16
I just got Cerberus up and running on my MacBook and noticed that everything is being rendered to the lower left quadrant of the app window (at 1/4 of the window size). However, the mouse position etc is still being calculated using the entire window so I figure the issue is tied to the rendering part of the app. I assume the issue is tied to the retina display and I've looked into preprocessor comands as well as xCode settings but haven't been able to figure out a solution. Also, the issue occur in apps running mojo as well as mojo2.

I'm running the latest OS and xCode version. Any ideas?
 

arawkins

New member
Joined
Nov 9, 2017
Messages
1
Hey there. I actually just had to resolve this in my own game. It seems to be related to HDPI (retina) screens. I was able to fix it by working off of the following stack overflow answer:
https://stackoverflow.com/questions...-left-quarter-of-the-screen/47171457#47171457

I updated th call to glViewport to use the framebuffer size instead of display size. I am pretty clueless with c++ and glfw so there are probably better ways to do this. I just kind of muddled through it.

In Cerberus/modules/mojo/native/mojo.glfw.cpp, I made the following changes:

Around line 20, I added two variables
Code:
int frameBufferWidth;
int frameBufferHeight;

On line 205, I initialized them:
Code:
frameBufferWidth=frameBufferHeight=0;

On line 216, call glfwGetFramebufferSize with the new variables:
Code:
glfwGetFramebufferSize(BBGlfwGame::GlfwGame()->GetGLFWwindow(), &frameBufferWidth, &frameBufferHeight);

Then I updated the call to glViewport on line 217 to use the new variables:
Code:
glViewport( 0,0, frameBufferWidth, frameBufferHeight );

That resolved things for me. Hope that helps!

(ps. I just noticed cerberus is on github. I can make a pull request if that is helpful, just let me know)
 
Top Bottom