ggiGetReadFrame(3) Set or get the current frame for display, writing and reading

Other Alias

ggiSetDisplayFrame, ggiSetWriteFrame, ggiSetReadFrame, ggiGetDisplayFrame, ggiGetWriteFrame

SYNOPSIS


#include <ggi/ggi.h>
int ggiSetDisplayFrame(ggi_visual_t vis, int frameno);
int ggiSetWriteFrame(ggi_visual_t vis, int frameno);
int ggiSetReadFrame(ggi_visual_t vis, int frameno);
int ggiGetDisplayFrame(ggi_visual_t vis);
int ggiGetWriteFrame(ggi_visual_t vis);
int ggiGetReadFrame(ggi_visual_t vis);

DESCRIPTION

These functions are used for selecting or getting the current buffers, when using the multiple buffering function of LibGGI.

ggiSetDisplayFrame sets the frame that gets displayed.

ggiSetWriteFrame sets the frame for write operations such as ggiPuts(3) and ggiPutHLine(3).

ggiSetReadFrame sets the frame for read operations, like ggiGetPixel(3) and the ggiCrossBlit(3) source.

ggiGetDisplayFrame reports the frame currently displayed.

ggiGetWriteFrame reports the frame currently written to.

ggiSetReadFrame reports the frame currently read from.

Frames are numbered from 0 to the number of frames requested minus 1.

RETURN VALUE

The ggiSet*Frame functions return 0 if they succeed, and an ggi-error(3) on failure.

The ggiGet*Frame functions never fail.

WORKING WITH FRAMES

People report about heavy flickering, they can't solve.

This is because they display the frame during rendering. Unless you know what you do, never set the same frame to write and display mode.

Wrong (causes flickering):

ggiSetWriteFrame(vis, framenr);
ggiSetDisplayFrame(vis, framenr);
/* render here */

Right:

ggiSetWriteFrame(vis, framenr);
/* render here */
ggiSetDisplayFrame(vis, framenr);