zoom doesnt work on orthographic camera, while OpenGL projection is 3D #2258
Replies: 5 comments 7 replies
|
Are you able to provide a minimal test case, screenshot or video of what it is you are seeing, and what it is you expect to see?
Do you mean culling? |
|
have you tried calling setZoom on the camera object? |
|
I'm not sure if this is quite the same case, but I also found that setZoom() did not work with an orthographic camera except when calling setZoom() immediately after creating the camera. So, once scene was being rendered calling setZoom() did nothing. In looking at the code in Camera.cpp , I added " _viewProjectionDirty = true;" in setZoom() immediately before it calls applyZoom(). This fixed it for me. |
|
To be clear, here's the modified function: void Camera::setZoom(float factor) |
|
Related to this -- I thank the OP with regards to his/her comment about calling: _director->setProjection(ax::Director::Projection::_2D); It makes me curious why this is set in the director and not a property of the camera? Consider having the projection as 3D, you create an ortho camera and call applyZoom(). applyZoom then turns it into a 3D camera, based on the director settings. I'm probably missing something, but this seems clearly wrong. |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
this is how I create my camera, and it does not apply the specified zoom, until I do this thing in my init scene function:
_director->setProjection(ax::Director::Projection::_2D);I want to know if this is how I should do it, or if this is a bug in the engine code ? (or maybe I made a mistake somewhere )
As for the standard camera, when you increase the zoom, the culling starts to work incorrectly, and standard sprites are cut off before they disappear from the screen, while spine elements are displayed correctly.
All reactions