4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CinderのGL/CameraPerspでwindowのresizeに対応する

4
Posted at

問題

こういうのがあって

image

なにも考えずにWindowをresizeするとこうなる.

そのまま視点 上から視点
image image

上から見るとわかりやすい.

対処

  • cinder::app::AppにWindow resize時のコールバックが用意されてる
  • cinder::CameraPerspにはCameraのAspectRatioを変更するメソッドがある

これらを利用する.

class AwesomeApp : public App {
public:
  // snip.
  void resize() override;

private:
  // snip.

  CameraPersp camera_;
};

// snip.

void AwesomeApp::resize() {
  camera_.setAspectRatio(getWindow()->getAspectRatio());
}
そのまま視点 上から視点
image image

問題なさそう.

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?