opengl: how to keep objects in window when it's resized

前端 未结 3 1844
陌清茗
陌清茗 2021-01-15 10:05

I\'m working a MS paint-like application on OpenGL using Bresenham\'s midpoint algorithm as homework. So far I can draw lines and ellipses. I lose them all when resizing the

3条回答
  •  粉色の甜心
    2021-01-15 10:18

    Don't think of it as "keeping them drawn". Think instead in terms of events and "when do I need to redraw my objects".

    For this you will need to handle the resize event and rerun your drawing code. I'm also guessing that your objects might not redraw themselves after another application is moved over them, or if it is moved off screen a little and then brought back. If this is the case you'll need to figure out what events to handle that will cause a redraw as well.

提交回复
热议问题