Alternative to double buffering ?

Previous topic - Next topic

Cliff3D

Hi. I'd either like to be able to turn double-buffering off (bad I gather, from the GLBasic point of view!) or be able to set a flag to tell GLBasic NOT to clear the backbuffer on SHOWSCREEN so that I can build an image up over time without keep redrawing things in code. A third alternative (which may exist for all I know) would be a way to copy the screen (not the backbuffer) to the background.

I reckon the fastest of these by far would be my favourite - a way to not clear the backbuffer on SHOWSCREEN or a way to draw directly to the screen (Having USESCREEN able to select the actual front viewing screen to paint on directly).

Cliff3D

Thanks, though I'm not sure that would do what I really want to. I want to be able to draw something like this:



a dot at a time. There's a lot of dots there. With all the SCREENSHOW business just drawing it a dot at a time and only seeing 2 dots at any stage is incredibly slow. I don't think BLENDSCREEN() would help there would it?

As for the manual - you know, I had only just finished typing up that I should go revisit the manual! I dived in rather deep when I got fed up with "supplying the bits that the manual didn't mention" during the tutorials. I DO mean to go back, but I wanted to see if I could get any kind of results in the direction I want to go before I spend a year going through it :(

Cliff3D

More than a bit sluggish! Which is one reason I'd rather be drawing directly on the screen rather than to a back buffer, in this instance.

In the long term I would eschew drawing a dot at a time at anything like the current speed, but as an assurance that my code was working it would have been nice to get better, faster screen response. I also sometimes find certain apparently  mundane, boring things mesmerising - I remember a fractal-based scren saver (part of a collection I believe was called "After Dark", though I could be wrong) that I found captivating. It's probably a good thing, for productivity, that I don't have a modern version of it!

I appreciate (as  dissapointed fan of Chuckie Egg) that a back buffer can be a vast improvement on flickery sprites - but different techniques are better suited to different tasks.

Ian Price

QuoteI appreciate (as  dissapointed fan of Chuckie Egg) that a back buffer can be a vast improvement on flickery sprites - but different techniques are better suited to different tasks.

Did someone mention Chuckie Egg?





Birds and background colours were subject to change - I have a range of colours for the birds.

WIP I was working on for the Wiz. I got distracted by a couple of comps. I must get back to it. I remember I was at a crossroads with regards to the big bird - I had a choice of making the game into Duckie Egg or Chickie Egg -



Anyway, back on topic...

Could you not draw to a hidden screen (CREATESCREEN/USESCREEN) then display? Are you using LIMITFPS? have you upped the FPS value?
I came. I saw. I played.

Moru

If you want to add a few pixels to the image each refresh, you can use USEASBMP or similar, not sure of the name right now. That saves whatever is in the backbuffer for the next draw.

Cliff3D

Quote from: Ian Price on 2010-Sep-02
Did someone mention Chuckie Egg?

Gorgeous looking update to the old classic! I always had difficulty working out why Chuckie Egg was so very playable - the number of colours (BBC user here) wasn't huge and it flickered like a demon - but was still hugely playable (obviously, I still have a copy immediately to hand under BBC emulation). How do you describe to other people "No, I know it looks flickery - but it's really fun to play. Honest!" ?

Please continue with the updated version! I don't have a Wiz, but it looks more appealing IMHO than the 8 bit graphics without losing the appeal (too many "remakes" lose too much of the feel of the original).

Quote from: Ian Price on 2010-Sep-02Anyway, back on topic...

Could you not draw to a hidden screen (CREATESCREEN/USESCREEN) then display? Are you using LIMITFPS? have you upped the FPS value?

I'm not using LIMITFPS at all, though CREATESCREEN/USESCREEN looks like it has potential. I may well try that out a bit later (it's not the main focus of attention, just somethign that would be nicer than I have now). Even better for me would be for GLBasic to extend the functionality of USESCREEN to just enable us to draw on the visible screen, and not need to call SHOWSCREEN at all - SHOWSCREEN really doesn't do this particular type of screen access any favours :(

If USESCREEN -2 (say) selected the front visible screen then I'd be VERY happy :D

Quote from: Moru on 2010-Sep-03
If you want to add a few pixels to the image each refresh, you can use USEASBMP or similar, not sure of the name right now. That saves whatever is in the backbuffer for the next draw.

Ah! While not the perfect ideal of simply being able to draw on the surface of the screen and eshew "SHOWSCREEN", I believe we have a winner! Thanks - that's probably going to save me a bunch of time and heartache :)

Thanks everyone for helping prove me right about this community - it IS looking worth spending time on GLBasic as the community is so welcoming AND knowledgeable!

Cliff3D

Ah - now tha tI've tried USEASBMP I seem tor ecall I tried that originally, before starting this thread, but it doesn't seem to work as intended. Here's a snippet:



and the (very crude) code that produces it:

Code (glbasic) Select
SETPIXEL MyModel.vtpoint[vtcount%].U# * 480 + 80, 480 - MyModel.vtpoint[vtcount%].V * 480, RGB(255, 255, 255)
USEASBMP
SHOWSCREEN


in a loop. I'm not deliberately clearing the backbugger at any stage, it just seems that old pixels fade away gently... most odd. For now I think I'll ignore it as the test I needed it for is basically complete, for now - I will probably try out the CREATESCREEN/USESCREEN option when I get to the next feature that would benefit from screen sketches as it goes (reading in facets rather than just a cloud of points) but, honestly, the best possible result for me would be to be able to draw ON the screen... a feture update to "USESCREEN" to be able to use the screen instead of a sprite or buffer or anything would offer DRAMATIC speed improvements for this kind of application :D