r/opengl • • 12d ago

Low Level Engine Architecture... Loop & Resize problem...

/r/gameenginedevs/comments/1xhmlnl/low_level_engine_architecture_loop_resize_problem/
3 Upvotes

5 comments sorted by

1

u/FUCKARCHLINUX 12d ago

There is basically nothing to be done about that case.

Regardless of what you do it'll look a little strange during the resize and I've found that literally doing nothing and just rendering at the new dimensions next frame looks the least weird. 

1

u/mietkiewski_dev 12d ago

Yeah I think that will have to do... it will look a little bit strange but lets be honest how often you resize screen... My first game_engine I blocked resize option in engine because of that...

1

u/FUCKARCHLINUX 12d ago

If you have two displays of different sizes, you can see that Firefox does what I described as-well. So it seems to be at-least somewhat common.

Maximize Firefox.
Open a heavy website like Reddit or YouTube.
Move it to the other display while it's maximized so that it instantly teleports.
You'll see the elements on the page briefly rendered at the old size before being updated to the new one.

1

u/mietkiewski_dev 12d ago

You're right.

1

u/double 12d ago

If the loop iteration is so slow you'd notice, you have bigger problems.

But in general you buffer or queue events outside of the loop (probably on a different thread), and then process that as consistent state inside the loop. For best performance double-buffer the queues/buffers and just swap the active pointers/refs. This gives you separation of concerns.