March 29, 2024, 06:25:35 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


need a quick way to copy buffers

Started by Blue Steel, September 21, 2008, 01:56:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blue Steel

hi,

I'm after a quick way to copy buffers after flip
I've found out that what i thought was happening isn't.. and this is my biggest headache

On older computers i've used when you draw something on a screen and flip it used to copy the buffers so that you only needed to do the graphics once

pseudocode
Draw to backbuffer
flip
(system used to then copy the front buffer to the backbuffer)
loop
move things drawing only any changes
flip


at the moment i'm having to

Pseudocode
Graphic commands drawing stuff to backbuffer
flip
loop
redo all graphic commands
flip
endloop

This means lots of redoing things that havn't altered
(which can slow things down a lot)

what i need is a way to do

pseudo code
Graphic commands drawing stuff to backbuffer
flip
loop
copy frontbuffer to back buffer
Do any chaphic changes
flip
endloop
  http://www.codingmonkeys.com
Covers many languages including Aurora , IWBasicEbasic (Ebasic, IBasic) , Creative Basic

Ionic Wind Support Team

It would be slower to copy an entire buffer.  The front buffer exists on a different memory bus, on the graphics card.  Flipping, in directx terms, means just switching a pointer from one GPU memory buffer to another, not copying data which would be extremely slow since data would have to be moved twice once from a GPU buffer into the CPU address space and then from the CPU address space into the other GPU buffer.

In full screen mode the buffers aren't erased between flips, so you could technically just update what has changed, until an alt-tab switch that is in which case Windows takes over and all GPU buffers are trashed.

Oh...I assume you are talking about 2D as 3D is entirely different.

Your biggest speedups can be achieved by locking buffers when you're in loops.  Without more details its hard to give advice.

Paul.
Ionic Wind Support Team

Blue Steel

sent you a pm with the code

no matter how many times i've tried.. every time i flip without redrawing EVERYTHING I just get a black screen after a flip.
not what was in the buffer.. I must be doing something majorly wrong
even right back to the ibasic days.. I've never had success which has been my major stumbling block
and yes its in 2D not 3D ..
  http://www.codingmonkeys.com
Covers many languages including Aurora , IWBasicEbasic (Ebasic, IBasic) , Creative Basic

Duffer

Cameron:  If you need help, drop a PM.  I am more than happy to help you with the 2D side of EB.  I still use EB for most of my 2D work.

Just be sure to PM instead of posting here as my membership expires in a week or so and I will be restricted when it comes to posting in certain forums  ;)