Jump to content
  • Advertisement
Sign in to follow this  
Gasimzada

resizing of a camera thats "inside" the view camera

This topic is 2146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to have a small viewport in the middle of a screen that is relative to the window size, with the aspect ratio kept intact. Like a mini map.

 

I have a resize function:

void resize(int width, int height) {
   foreach(camera : Cameras) {
      camera->setPerspectiveWithSameFOVNearAndFar((float)width/height);
      camera->setViewport(width, height);
   }
}

When I have two cameras, both of their viewports gets resized to the new width and height which makes the minimap as big as the actual view.

Share this post


Link to post
Share on other sites
Advertisement

Well that's what your code does (assuming that you store all your cameras in Cameras).

 

Maybe just call the code on the minimap camera?

 

Cheers!

Share this post


Link to post
Share on other sites

After playing with the code, I understood what I was doing wrong. In order to achieve what I want, the viewport size should change relative to the aspect ratio, not just receive the new size passed without any calculations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!