PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

how to implement double buffering with GAPI?

Can anyone help me?
I tried alot of things but it never worked...
all I want to do is to fill a temporery buffer with data, and then display it on the screen all at once...
help? please???
Give PocketHAL a try. It's the fastest library around for double buffered graphics on the PPC.
ilanprod · 02 Aug 2004, 20:06 UTC — hmm
Is it free?
I mean free for comercial games?
because all the librarys I saw was free for freeware games, and it cost money for comercial games...

But anyway, if anyone knows how to it, please help.
PocketHAL is free for commercial use.
Thierry,
How much is the suggested donation for registering pockethal to remove the small pockethal version number?
jweldin wrote:Thierry,
How much is the suggested donation for registering pockethal to remove the small pockethal version number?


Nothing is suggested, that's the whole point. I want people to send what they think is fair, not impose some fixed amount.
ilanprod · 02 Aug 2004, 21:52 UTC — grr
Thierry":2q1d6hej]
that's preety annoyong...
so,, my question is still need to be answered, please?
If you think that is "annoyong", then don't use it and ask your questions elsewhere.
ilanprod · 02 Aug 2004, 22:29 UTC — "welcome to our forum"
rcp wrote:If you think that is "annoyong", then don't use it and ask your questions elsewhere.

Thank you :)
but I wont leave this forum just because you dont like what I said.

now I will expand my question\problem.
when I try lets say clear the screen, so I can see a little flicker, when the pixels are passing...
is there something like VSYNC in GAPI?
when I try lets say clear the screen, so I can see a little flicker, when the pixels are passing...
is there something like VSYNC in GAPI?


When GXOpenDisplay returns a memory buffer, GXBeginDraw behaves like locking the backbuffer surface in DirectX. Likewise, GXEndDraw behaves like unlocking the surface and calling flip in DirectX. I assume that "flip" always works synchronized to VSYNC.
I am not sure, what happens if GXOpenDisplay does not return a memory buffer.

When GXOpenDisplay returns a memory buffer, GXBeginDraw behaves like locking the backbuffer surface in DirectX. Likewise, GXEndDraw behaves like unlocking the surface and calling flip in DirectX. I assume that "flip" always works synchronized to VSYNC.
I am not sure, what happens if GXOpenDisplay does not return a memory buffer.


Depends on the device, but GXOpenDisplay just opens the display for drawing and allows you to hide the toolbar.

Calling GXBeginDraw() returns a pointer *usually* to the display memory, Though it can return to a BackBuffer, check this using GXIsDisplayDRAMBuffer()

To double buffer, create a memory buffer sized (width*height)*sizeof(short)), assuming the device is a RGB565 device. (most are, but get the pixel format using GXGetDisplayProperties() )

Draw to the buffer you have created, and at the end of the frame, get a display pointer from GXBeginDraw() and do a blit to the address it returns, then call GXEndDraw()

As far as im aware, none of the devices on the market now can do a page flip, the simple reason being they don't have enough video memory to hold two full screen buffers, so a Dram->Vram blit is the usual way of double buffering.
Draw to the buffer you have created, and at the end of the frame, get a display pointer from GXBeginDraw() and do a blit to the address it returns, then call GXEndDraw(


I was under the impression, that GXEndDraw also performs a synchonized blit/flip if GXOpenDisplay returns a memory (DRAM) buffer.

the simple reason being they don't have enough video memory to hold two full screen buffers, so a Dram->Vram blit is the usual way of double buffering.


What you are suggesting is, that the blit to VRAM is always not synchonized (mainly because you do it yourself and you do not have VSYNC information). Isnt there the danger of artifacts like tearing?
gamefreaks wrote:As far as im aware, none of the devices on the market now can do a page flip, the simple reason being they don't have enough video memory to hold two full screen buffers

the problem is more about API. a device using system memory for framebuffer could easily allocate more surfaces (i'am sure PocketHAL will do this for you, if you use the right options) and there are graphics chips with more then one frame buffer memory (example ATI Imageon3200 in E800 which can do the flipping via AHI interface). hopefully there will be a general solution when DirectDraw will be default under Windows Mobile.

same goes with tearing. if you use RGB framebuffers currently my best bet is PocketHAL (although i never really used it. I'am in the YUV business :) )

I was under the impression, that GXEndDraw also performs a synchonized blit/flip if GXOpenDisplay returns a memory (DRAM) buffer.


Usually returns an address to VRam, what you draw will be displayed immediatly. If GXIsDisplayDRAMBuffer() returns true, it will return a DRam pointer, and GXEndDraw() will do the final blit to VRam.


What you are suggesting is, that the blit to VRAM is always not synchonized (mainly because you do it yourself and you do not have VSYNC information). Isnt there the danger of artifacts like tearing?


Yeah, using GAPI anyway. I think the only way around tearing is to interface with the display drivers or hardware directly, as Picard described.