Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
On resizing of window/view, the objects tends to zoom in and out. I want the objects to be shown without this effect. So when i shrink the window the object should not shrink and vice versa. I have tried resetting the device with backbuffer (having new window size) but it is not helping. Am i missing anything that needs to be done?
It would be of great if any one can suggest any solution.
Posted

1 solution

There's (at least) two things you can do.

The first is to adjust the camera position to compensate for the change in size of the screen. If the camera position relative the observed object is unchanged when the window size is doubled, the apparent size of the object will also double, but if you move the camera back you can compensate for this. This approach has the downside of actually changing the point of view, which may or may not be what you want.

Another approach is to render to a virtual surface and then render that surface unscaled to the screen. This requires the view port used for the camera to be independent of the size of the window and might look weird if the size of the virtual surface is smaller than the size of the window.
 
Share this answer
 
Comments
Member 11590284 10-Apr-15 2:33am    
Thanks Fredrik. The moving of camera serves the purpose of stopping the zoom effect. But i have two queries.
1. how do i set the initial position of the camera as the window size can be small or large depending on the size of the window at the time of closure of the application?
i mean, open application -> resize screen -> close application -> re-open application.
The size of the screen is preserved at the closure of the application.
2. Is there any restriction on the movement of the camera to a certain point? When i reduce the size of the screen by say about 200% of the original size then the images gets enlarged. This is happening as the camera is getting set at around 0 or +ve z-axis.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900