Untitled Document
The VRAM features room enough for two 320x320 screens. The brand new thing
with the Clie is the page flipping. This process allow the video physical adress
(what will be seen on screen) to switch between 2 location in video memory (VRAM).
This is useful to provide smooth animation.
Two main policies are to be found through the world of electronic devices:
- offscreen copy: found in former palm devices, windows, MacOS
This
consists of rendering your next screen on an offscreen, generaly in main RAM
(heap) and then copy the whole stuff to the physical screen. This is slow
coz of the large chunk of memory to move, generaly slow access to VRAM. The
other drawback is you see the redraw on the screen.
- Page Flipping: found mostly in console games such as Playstation, directX
you build your screens alternatively on two memory locations. When a render
is finished, you just tell the pysical screen to point on the new build screen.
The main advantage is you spare the large memory transfer. The drawback is
the heavy consumption of VRAM due to the booking of the both screens. The
other one is the need to buid your screen from elements also located in VRAM.
To get the screen adress to build the next picture, in your main loop, use:
offscreenAdress= WinScreenLock(winLockDontCare);
this will lock the display on the displayed screen and send back the adress
of the other screen buffer. Then you do all your erase screen, draw new stuff,
watever you do to render your next image on the screen starting at offscreenAdress.
You can use other parameters for this function:
winLockCopy: Copy old
screen to new.
winLockErase: Erase new
screen to white.
winLockDontCare: Don't
do anything
Once you finish your render, use the instruction:
WinScreenUnlock();
This will wait the next VBL (vertical Blank interupt) and then switch the display
to the freshly rendered screen. This way you won't suffer any screen tearing
effect.
So simple.
WM.