C++ and SDL2

Started by cpsmith0191, June 13, 2019, 19:13:58

Previous topic - Next topic

cpsmith0191

I'm using SDL2 with C++ for a point and click menu system.
Should I redraw the back buffer on every pass of the input loop or just redraw the back buffer on every change.
IE
'While prog is running, check for input, draw everything to back buffer , then flip.'
OR
'While prog is running, check for input, draw changes to back buffer if any are needed , then flip.'

It's a hang over from Blitz where you would redraw everything on every pass.
Any advice appreciated, have fun cps.

Dabz

I'd just draw every pass, I mean, it'll harm nothing, your main game loop will be doing it and will be more CPU/GPU intensive, basically, I wouldn't worry about it!

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

markcwm

If it's not a game or virtual scene, then yes I believe the correct thing is to redraw only when something has changed, if you're multi-tasking this should reduce excess processing.

cpsmith0191

Ummm. I've never seen any deviant pixels in SDL2 relying on the back buffer's stability, so I'll only redraw changes at the moment.
When I get onto complex interactions (games) or if back buffer proves unstable, I'll go for redraw everything.
Many thanks for input. 'The Deviant Pixels' nice name for a band (well maybe)? Have fun cps.

Baggey

Quote from: cpsmith0191 on June 17, 2019, 20:57:14
Ummm. I've never seen any deviant pixels in SDL2 relying on the back buffer's stability, so I'll only redraw changes at the moment.
When I get onto complex interactions (games) or if back buffer proves unstable, I'll go for redraw everything.
Many thanks for input. 'The Deviant Pixels' nice name for a band (well maybe)? Have fun cps.

What IDE, C++ are you using for this setup?

Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on Acer 24" . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!