Blitz+ Example Code Problem...

Blitz3D Forums/Blitz3D Beginners Area/Blitz+ Example Code Problem...

bubbz(Posted 2003) [#1]
Having just grasped the concept of buffers, I tried out the example code in the most recent blitzplus docs command reference under FrontBuffer().

The code draws randomly sized and coloured rectangles until escape is pressed.

Strangely I can't see any rectangles being drawn, but if i bring another window infront of the blitzcc window, then return to the blitzcc one the rectangles appear, although i still don't see the new ones being added.

Can somebody explain what is happening? I'm using blitzplus v1.35 and win2k.

Thanks.


BlitzSupport(Posted 2003) [#2]
Use BackBuffer to render everything, then call Flip. I believe FrontBuffer in BlitzPlus actually refers to BackBuffer anyway, for compatibility's sake (ie. there isn't a real front buffer you can draw to)...


bubbz(Posted 2003) [#3]
Thanks for the reply, a well placed flip was all that was needed. Seem's that this could be corrected in the blitzplus docs next time there is a release...


Mark Tiffany(Posted 2003) [#4]
done (in the online docs anyway).


Stoop Solo(Posted 2003) [#5]
Heh heh... flashback!

That one had me ranting away when I first got my hands on B+ and was trying to port over some olde-worlde PowerBASIC stuff as a learning exercise. The process went along the lines of:

"RANT RANT RAVE why the **** won't this work, how the **** am I sposed to do a relatively simple operation like this when I can't write directly to the buffer useless RANT RANT"

*gives up, writes to backbuffer and flips*

".... .... oh. Ok. I spose that kinda works. Really well. And potentially much tidier than the way I was trying. ...Grumble grumble..."


Oh yeah, I wanted to mention one thing about flipping to bubbz, as I found it useful: You may want to use the instruction "Flip False" instead of just "Flip". Flip waits for a vertical blank before continuing. Which is nice and smooth, but means any game you make will vary in speed with monitor refresh rate, whereas Flip False will update the buffer imediately, so will be much quicker. You can then control the game speed with as much subtlety as you want, using other means which will be consistent whatever monitor refresh is used.