Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Double buffering gosu game
- - By arrow Date 2010-08-14 12:26
How do you do it? I just started writing games in gosu and my backdrop bleeds through my objects when they're moving. Tried to google it, but didn't find anything.

I tried splicing all my images to one using texplay and then draw that image, which caused huge performance issues.
Parent - By mathias Date 2010-08-14 12:32
I have never noticed anything like that, can you show us some code/video/screenshots?
Parent - - By Basic Date 2010-08-14 12:49
"I tried splicing all my images to one"

I think Gosu cuts up big images anyway.

Could you post a  screenshot?
Parent - - By arrow Date 2010-08-14 17:53
Seems like it is double buffering, my bad. What I saw was just my backdrop flashing through at the edges; an illusion of the my backdrop bleeding through.

Quick question, gosu won't reveal anything while the draw function is active?
Parent - - By erisdiscord Date 2010-08-14 19:53
That's right—Gosu's drawing process is kind of different to what a lot of people seem to be used to.

Whenever you call one of the draw methods, what is actually happening behind the scenes is Gosu creates a DrawOp object that holds, references to, say, the current transformation stack, the image and whatever else you provided. This DrawOp object is inserted into what is essentially a priority queue, sorted by Z order.

After your Window#draw method returns, or whenever you call gl { … }, the DrawOp queue is flushed. This is when the actual drawing is done: each item is popped off the queue—starting at the back and working forward—transformations are applied and the image is drawn to the screen.

So no, nothing is actually drawn to the screen during your draw method. :)
Parent - - By AmIMeYet Date 2010-08-14 22:19
Great explanation :D
Parent - By erisdiscord Date 2010-08-14 23:21
Thanks, I hope it's not too confusing. I thought it was a pretty clever way of doing it, although it did make the transforms system more complex to implement. Too complex for me to get it working well on my own, anyway. :)
Up Topic Gosu / Gosu Exchange / Double buffering gosu game

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill