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/pd/pdcreatedirectcontext.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/pd/pdcreatedirectcontext.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/pd/pdcreatedirectcontext.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/pd/pdcreatedirectcontext.html on line 8

PdCreateDirectContext()

Create a direct-mode context

Synopsis:

PdDirectContext_t *PdCreateDirectContext( void );

Library:

ph

Description:

This function creates a direct-mode context. The context isn't activated at this point, and the graphics driver is still operating normally (i.e it's still Reply Blocked on Photon).

When an application enters direct mode, it's requesting that the graphics driver receive draw streams and service messages directly from the application, instead of from Photon. The driver blocks on the application, which is now responsible for telling the graphics driver what to do.


Note: You must target this function at a specific card by calling PdSetTargetDevice().

Returns:

A pointer to a PdDirectContext_t structure if successful, or NULL on failure.

Examples:

PdDirectContext_t *DirectMode=NULL;
PhDrawContext_t *Olddc=NULL;
PhRid_t rid_array[10];

DirectMode=PdCreateDirectContext();
if (DirectMode == NULL)
{
    // error code
}

if( PdGetDevices(rid_array, 10) > 0)
{
   PdSetTargetDevice( (PhDrawContext_t *) DirectMode,
                      rid_array[0] );
   Olddc=PdDirectStart(DirectMode);
   PgSetFillColor(Pg_PURPLE);
   PgDrawIRect(0,0,300,300,Pg_DRAW_FILL);
   PgFlush();      // Draw the purple rect
   PdDirectStop(DirectMode);

   // When the driver leaves direct mode, an expose event
   // is emitted, which will erase our rectangle, so we
   // sleep for a bit so we can see that the rectangle
   // was drawn.
   sleep(5);
}

PdReleaseDirectContext(DirectMode);
PhDCSetCurrent(Olddc);

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PdDirectStart(), PdDirectStop(), PdReleaseDirectContext(), PdSetTargetDevice()

Direct mode 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/pd/pdcreatedirectcontext.html on line 148

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/pd/pdcreatedirectcontext.html on line 148