Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 8

PgSwapDisplay(), PgSwapDisplayCx()

Point the CRT of the video display at a given context

Synopsis:

int PgSwapDisplay( PdOffscreenContext_t *osc,
                   unsigned long flags );

int PgSwapDisplayCx( PhGC_t *gc,
                     PdOffscreenContext_t *osc,
                     unsigned long flags );

Library:

ph

Description:

These functions point the CRT of the video display at the context indicated by osc. These functions can be used for double and triple buffering. They're available only in direct mode.

The flags argument is a combination of the following bits:

Pg_SWAP_BLIT
Blit the contents of the new target to the old one.
Pg_SWAP_VSYNC
Wait for a Vsync to occur before continuing to parse the draw stream.

Note: To guarantee that you can point the CRT at this target, you should create it with the flag Pg_OSC_CRTC_SAFE.

PgSwapDisplay() works on the current graphics context, while you can specify the graphics context gc for PgSwapDisplayCx().

Returns:

0
Success.
-1
An error occurred.

Examples:

This example of double buffering assumes we're in direct mode already:

PdOffscreenContext_t *buf[2];
int cur_buf=1;

// Create an offscreen context from the current screen:
buf[0] = PdCreateOffscreenContext(0,0,0,Pg_OSC_MAIN_DISPLAY);

// Duplicate the buffer:
buf[1] = PdDupOffscreenContext(buf[0],Pg_OSC_CRTC_SAFE);

while (not_done)
{
    PhDCSetCurrent(buf[cur_buf]);
    RenderMyFrame();
    PgSwapDisplay(buf[cur_buf],0);
    PgFlush();
    cur_buf = cur_buf ? 0 : 1;
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PdCreateOffscreenContext(), PdDupOffscreenContext(), PdGetOffscreenContextPtr(), PdOffscreenContext_t, PgContextBlit*()

Video memory offscreen in the Raw Drawing and Animation chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 169

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgswapdisplay.html on line 169