Any way to detect if DoubleBuffer is on?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 788
Joined: Sun Feb 14, 2010 7:11 pm

Any way to detect if DoubleBuffer is on?

Post by Bugala » Wed Sep 11, 2019 3:38 pm

Any way to detect if DoubleBuffer is on or off?

I am making this function that basically starts by turning doubebuffer off, but at beginning it is not on, and therefore comes error message.

I can get around this using dirty ways, but would prefer a clean way.

User avatar
emeck
Posts: 73
Joined: Fri Apr 03, 2015 3:17 pm

Re: Any way to detect if DoubleBuffer is on?

Post by emeck » Wed Sep 11, 2019 5:37 pm

Would checking for #ERR_NODOUBLEBUFFER with GetLastError to continue execution or disable double buffering be a clean way?

Bugala
Posts: 788
Joined: Sun Feb 14, 2010 7:11 pm

Re: Any way to detect if DoubleBuffer is on?

Post by Bugala » Wed Sep 11, 2019 8:08 pm

Disabling double buffer would be clean, but then I would lose the benefits of double buffer.

Error handling is not really a clean way, as a dirty trick I was thinking of disabling error messages and execute the command, then turn error handling back on, but would rather not do that.

Current solution I am thinking is simply taking care myself that doublebuffer is on when entering the function, since basically only time that is having that problem that comes to my mind is when it is called the first time, so I can first turn doublebuffering on before using it for the first time. It is bit of a hack, but if there is no way to check if double buffering is on, then I guess that is the closest to clean solution.

User avatar
airsoftsoftwair
Posts: 3121
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Any way to detect if DoubleBuffer is on?

Post by airsoftsoftwair » Wed Sep 11, 2019 8:31 pm

You can query #ATTRDOUBLEBUFFER for #DISPLAY.

User avatar
emeck
Posts: 73
Joined: Fri Apr 03, 2015 3:17 pm

Re: Any way to detect if DoubleBuffer is on?

Post by emeck » Wed Sep 11, 2019 9:44 pm

Bugala wrote:
Wed Sep 11, 2019 8:08 pm
Error handling is not really a clean way, as a dirty trick I was thinking of disabling error messages and execute the command, then turn error handling back on, but would rather not do that.
OK, I understand what you mean.

User avatar
emeck
Posts: 73
Joined: Fri Apr 03, 2015 3:17 pm

Re: Any way to detect if DoubleBuffer is on?

Post by emeck » Wed Sep 11, 2019 9:48 pm

airsoftsoftwair wrote:
Wed Sep 11, 2019 8:31 pm
You can query #ATTRDOUBLEBUFFER for #DISPLAY.
So you can start double buffering when creating the display also or only with BeginDoubleBuffer and it is set to the current display?

Bugala
Posts: 788
Joined: Sun Feb 14, 2010 7:11 pm

Re: Any way to detect if DoubleBuffer is on?

Post by Bugala » Thu Sep 12, 2019 10:06 am

airsoftsoftwair wrote:
Wed Sep 11, 2019 8:31 pm
You can query #ATTRDOUBLEBUFFER for #DISPLAY.
Ah, great. Figured there might be something like that existing, just couldn't figure out where to look at, although, should have realized now that I see it.

Post Reply