• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Fixed Mac OSX High Sierra Desktop mode Graphics Size incorrect

Matt

New member
Joined
Feb 17, 2018
Messages
3
Hi, I'm getting an issue when compiling to the desktop target on Mac osx. Rendering to an imagecanvas only draws to the bottom left quarter of the window even a full imageCanvas.clear r,g,b will only fill up the bottom left quarter with the colour. But compiling to HTML5 it works fine. Is this a bug, possibly to do with how the mac deals with half-pixels, or is there something I'm missing that I should be doing?

Code:
Import mojo2

Class MyApp Extends App

Field image:Image
Field imageCanvas:Canvas
Field windowCanvas:Canvas 

Method OnCreate()
image=New Image( DeviceWidth,DeviceHeight,0,0 )
imageCanvas=New Canvas( image )
windowCanvas=New Canvas
SetUpdateRate 30
End

Method OnRender()
imageCanvas.PushMatrix()
imageCanvas.Clear 128,0,255
imageCanvas.Flush
imageCanvas.PopMatrix
windowCanvas.Clear
windowCanvas.DrawImage image
windowCanvas.Flush
End

End

Function Main()
New MyApp
Return True
End
 
What values does DeviceWidth/Height report back? Did you use a config file to set the window?
What machine do you run it on?
 
I'm running it on:
MacBook Pro (Retina, 15-inch, Late 2013)
2.6 GHz Intel Core i7
16 GB 1600 MHz DDR3
NVIDIA GeForce GT 750M 2 GB
Intel Iris Pro 1536 MB

I'm running Cerberus V2017-10-24.

I haven't edited the config file for either the HTML5 or the Desktop version.

In HTML5 it reports back DeviceWidth 640 and DeviceHeight 480 and displays correctly.
In Desktop (Glfw3) it also reports back DeviceWidth 640 and DeviceWidth 480 and the window is that size when compared to other software but the only part draw in is the bottom left at a size of 320x240. See the screenshot below for the comparison:
Cerberus_Screenshot.jpeg
 
Last edited:
I will setup my El Capitan Imac in the next days to see if I can recreate this behaviour. I have a feeling that it is another quirk of High Sierra.
 
The problem is that the viewport was set incorrectly. I think that has something to do with the retina display from iMac. (4k)


We are currently using glfwGetWindowSize() in gxtkGraphics::BeginRender() to determine the widht and height of the screen, but we need to use glfwGetFramebufferSize instead.

I have changed the file mojo.glfw.cpp

C++:
int gxtkGraphics::BeginRender(){

   width=height=0;
 
#ifdef _glfw3_h_
   glfwGetWindowSize( BBGlfwGame::GlfwGame()->GetGLFWwindow(),&width,&height );
#else
   glfwGetWindowSize( &width,&height );
#endif

#if CFG_OPENGL_GLES20_ENABLED
   return 0;
#else

   glViewport( 0,0,width,height );

   .......
 
 
   return 1;
 
#endif
}

to this

C++:
int gxtkGraphics::BeginRender(){

   int newWidth=0;
   int newHeight=0;
 
   width=height=0;
 
#ifdef _glfw3_h_
   glfwGetFramebufferSize(BBGlfwGame::GlfwGame()->GetGLFWwindow(),&newWidth,&newHeight );
#else
   glfwGetWindowSize( &width,&height );
#endif

#if CFG_OPENGL_GLES20_ENABLED
   return 0;
#else

   glViewport( 0,0,newWdth,newHeight );

   .......
 
 
   return 1;
 
#endif
}
 
Awesoem that you have found and fixed the problem. I will test it under El Capitan. If that fix works there too, I will add it to the repository.
 
I've copied the edits suggested above into my mojo.glfw.cpp file but it doesn't seem to make any difference in High Sierra unless there's something I'm doing wrong.
 
I diddn´t saw that you are using mojo2. This fix only works with mojo1.

I have checked your code quickly and I have currently not enough time. But if you open your compiled main.cpp check for "glViewport" in the
Code:
c_Canvas::_Validate
method.

If you change

Code:
glViewport(m__vpx,m__vpy,m__vpw,m__vph)

to

Code:
glViewport(m__vpx,m__vpy,m__vpw*2,m__vph*2)

it works. If you want to run on other devices you need to use glfwGetFramebufferSize().


Mojo2 also use the DeviceWidth/DeviceHeight to set the viewport.
 
Last edited:
Back
Top Bottom