MPKWindow - MPKWindow functional interface.| MPKWindow* | mpkWindowNew(void ); |
| void | mpkWindowDelete(MPKWindow* window); |
| void | mpkWindowSetName(MPKWindow* window, const char* name); |
| const char* | mpkWindowGetName(MPKWindow* window); |
| void | mpkWindowSetRunon(MPKWindow* window, int cpu); |
| int | mpkWindowGetRunon(MPKWindow* window); |
| void | mpkWindowSetViewport(MPKWindow* window, float vp[4]); |
| void | mpkWindowGetViewport(MPKWindow* window, float vp[4]); |
| int | mpkWindowNChannels(MPKWindow* window); |
| MPKChannel* | mpkWindowGetChannel(MPKWindow* window, int i); |
| void | mpkWindowAddChannel(MPKWindow* window, MPKChannel* c); |
| int | mpkWindowRemoveChannel(MPKWindow* window, MPKChannel* c); |
| MPKPipe* | mpkWindowGetPipe(MPKWindow* window); |
| MPKConfig* | mpkWindowGetConfig(MPKWindow* window); |
| MPKChannel* | mpkWindowFindChannel(MPKWindow* window, const char* name); |
| MPKWindow* | mpkWindowGetProxy(MPKWindow* w); |
| void | mpkWindowSetAttribute(MPKWindow* window, int attr, int value); |
| void | mpkWindowUnsetAttribute(MPKWindow* window, int attr); |
| void | mpkWindowResetAttribute(MPKWindow* window, int attr); |
| int | mpkWindowTestAttribute(MPKWindow* window, int attr); |
| int | mpkWindowGetAttribute(MPKWindow* window, int attr, int* value); |
| void | mpkWindowSetEventCB(MPKWindow* window, int which, MPKWindowEventCB cb); |
| void | mpkWindowSetDrawCB(MPKWindow* window, int which, MPKWindowDrawCB cb); |
| void | mpkWindowSetCullCB(MPKWindow* window, int which, MPKWindowCullCB cb); |
| MPKWindowEventCB | mpkWindowGetEventCB(const MPKWindow* window, int which); |
| MPKWindowDrawCB | mpkWindowGetDrawCB(const MPKWindow* window, int which); |
| MPKWindowCullCB | mpkWindowGetCullCB(const MPKWindow* window, int which); |
| int | mpkWindowInit(MPKWindow* window); |
| void | mpkWindowExit(MPKWindow* window); |
| void | mpkWindowFreeze(MPKWindow* window, int freeze); |
| void | mpkWindowResize(MPKWindow* window); |
| void | mpkWindowApplyViewport(MPKWindow* window); |
| void | mpkWindowUpdatePixelViewport(MPKWindow* window); |
| void | mpkWindowSetPixelViewport(MPKWindow* window, int pvp[4]); |
| void | mpkWindowGetPixelViewport(MPKWindow* window, int pvp[4]); |
| int | mpkWindowGetMode(MPKWindow* window); |
| void | mpkWindowSetUserData(MPKWindow* window, void* userData); |
| void* | mpkWindowGetUserData(MPKWindow* window); |
| void | mpkWindowSelectInput(MPKWindow* window, long event_mask); |
| void | mpkWindowProcessEvent(MPKWindow* window, MPKEvent* event); |
| void | mpkWindowCreate(MPKWindow* window); |
| void | mpkWindowDestroy(MPKWindow* window); |
| void | mpkWindowOpenDisplay(MPKWindow* window); |
| void | mpkWindowCloseDisplay(MPKWindow* window); |
| void | mpkWindowCreateDrawable(MPKWindow* window); |
| void | mpkWindowDestroyDrawable(MPKWindow* window); |
| void | mpkWindowMapDrawable(MPKWindow* window); |
| void | mpkWindowCreateContext(MPKWindow* window); |
| void | mpkWindowDestroyContext(MPKWindow* window); |
| int | mpkWindowMakeCurrent(MPKWindow* window); |
| int | mpkWindowMakeCurrentNone(MPKWindow* window); |
| void | mpkWindowSwapBuffers(MPKWindow* window); |
| void | mpkWindowSetDisplay(MPKWindow* window, Display* display); |
| Display* | mpkWindowGetDisplay(MPKWindow* window); |
| void | mpkWindowSetInputDisplay(MPKWindow* window, Display* display); |
| Display* | mpkWindowGetInputDisplay(MPKWindow* window); |
| void | mpkWindowSetParent(MPKWindow* window, XID parent); |
| XID | mpkWindowGetParent(MPKWindow* window); |
| void | mpkWindowSetScreen(MPKWindow* window, int screen); |
| int | mpkWindowGetScreen(MPKWindow* window); |
| GLXFBConfig* | mpkWindowChooseFBConfig(MPKWindow* window, int* nitems); |
| void | mpkWindowSetFBConfig(MPKWindow* window, GLXFBConfig fbConfig); |
| GLXFBConfig | mpkWindowGetFBConfig(MPKWindow* window); |
| XVisualInfo* | mpkWindowChooseVisual(MPKWindow* window); |
| void | mpkWindowSetVisual(MPKWindow* window, XVisualInfo* visInfo); |
| XVisualInfo* | mpkWindowGetVisual(MPKWindow* window); |
| void | mpkWindowSetPixmap(MPKWindow* window, Pixmap pixmap); |
| Pixmap | mpkWindowGetPixmap(MPKWindow* window); |
| void | mpkWindowSetDrawable(MPKWindow* window, XID drawable); |
| XID | mpkWindowGetDrawable(MPKWindow* window); |
| void | mpkWindowSetContext(MPKWindow* window, GLXContext context); |
| GLXContext | mpkWindowGetContext(MPKWindow* window); |
MPKPipe, potentially associated with an X11 Drawable for rendering. After its creation by mpkWindowInit the thread loops through the following sequence:
wait for next mpkConfigFrameBegin()
if (first time)
for each MPKChannel [of the window]
invoke the channel's cull-init callback function
invoke the channel's draw-init callback function
end for
end if
invoke the window's draw-update callback function
for each MPKChannel [of the window]
if ( in mono )
for eye MPK_EYE_CYCLOP
invoke the channel's cull-update callback function
invoke the channel's draw-clear callback function
invoke the channel's draw-update callback function
end for
else ( in stereo )
for eye MPK_EYE_LEFT and eye MPK_EYE_RIGHT
invoke the channel's cull-update callback function
invoke the channel's draw-clear callback function
invoke the channel's draw-update callback function
end for
end if
end for
synchronize mpkWindowSwapBuffers (through mpkConfigFrameEnd())
|
name. This is done by copy and not by reference.cpu on which to assign the passed MPKWindow thread. In addition, the following symbolic values can be used: | MPK_RUNON_AUTO | The window threads will be automatically placed on a CPU close to their respective graphics pipe, if possible. |
| MPK_RUNON_FREE | All threads are free to execute on whatever processor the system deems suitable. |
| MPK_UNDEFINED | The thread placement is defined by the config's runon value. |
vp.vp.MPKChannel in passed window.ith MPKChannel in passed window.c to list of channels for passed window.c in list of MPKChannel for passed window and removes it from the list if it is found.MPKPipe of the passed MPKWindow.MPKConfig of the passed MPKWindow.MPKChannel with specified name in the passed MPKWindow and returns the match if found or NULL otherwise.MPKGlobal man page for a description of all MPKWindow attributes and their default or possible values.attr to value.attr or, if attr is MPK_WATTR_ALL, unsets all attributes for the passed MPKWindow.attr to its corresponding default value or, if attr is MPK_WATTR_ALL, it resets all attributes for the passed MPKWindow to their default value.attr is set for the passed MPKWindow, 0 otherwise.attr and returns 1 if the attribute is set for the passed MPKWindow, 0 otherwise.which to the passed function, of type:which areMPK_WINDOW_EVENTCB_ANY callback for each event received on that window.MPK_WINDOW_EVENTCB_ANY callback is set to mpkWindowProcessEvent().which to the passed function, of type:which arewhich to the passed function, of type:which arewhich. Accepted values for which arewhich. Accepted values for which arewhich. Accepted values for which are
invoke the config's windows initialization callback
for each MPKChannel in the window
invoke the config's channels initialization callback
end for
enter lifelong loop
|
MPK_WATTR_HINTS_THREAD attribute).window, which causes the window thread to execute the pseudo-code below prior to exiting:
for each MPKChannel in the window
invoke the config's channels exit callback
end for
invoke the config's windows exit callback
|
freeze argument causes subsequent mpkConfigFrame() to perform without invoking any rendering callback for the passed MPKWindow ie. the window will be "frozen". Otherwise, frames will be rendered as usual.window according to the current display size and fractional viewport.
#define IRND(a) ((int)((a)+.5))
// compute first pixel position of the window
window.pvp[0] = IRND(window.vp[0] * pipe.width);
window.pvp[1] = IRND(window.vp[1] * pipe.height);
// compute last pixel position of the window
window.pvp[2] = IRND((window.vp[0]+window.vp[2]) * pipe.width);
window.pvp[3] = IRND((window.vp[1]+window.vp[3]) * pipe.height);
// compute window's dimension
window.pvp[2] -= window.pvp[0];
window.pvp[3] -= window.pvp[1];
|
vp(1): [0. 0. 0.3333 1. ] pvp(1): [0 0 427 1024]
vp(2): [0.3333 0. 0.3333 1. ] pvp(2): [427 0 426 1024]
|
pvp.MPK_STEREO_NONE, MPK_STEREO_RECT, MPK_STEREO_QUAD, MPK_STEREO_TOP, MPK_STEREO_BOT or MPK_STEREO_USER.window structure. Transport is done by reference and not by copy.window's event mask if this window has an input display and an X window drawable. Note that the window's input display is set via mpkWindowOpenDisplay() or mpkWindowSetInputDisplay().event's X window does not match the passed MPKWindow drawable. Otherwise mpkWindowProcessEvent invokes the user-specified related MPKEvent callback, if any.
void initWindow( MPKWindow *w )
{
mpkWindowSetEventCB( w, MPK_WINDOW_EVENTCB_ANY, windowEvent );
mpkWindowSetEventCB( w, MPK_WINDOW_EVENTCB_KEYBOARD, windowKB );
}
void windowEvent( MPKWindow *w, MPKEvent *event )
{
MPKEventXData *data = (MPKEventXData *)mpkEventGetData(event);
switch ( data->x->type )
{
// Use my own event processing for these events
case ClientMessage:
myProcessEvent( event );
break;
// Use MPK event processing for other events, eg.
// keyboard events.
default:
mpkWindowProcessEvent( w, event );
}
}
void windowKB( MPKWindow *w, MPKEvent *event )
{
// Will be invoked by MPK upon keyboard events
MPKEventXData *data = (MPKEventXData *)mpkEventGetData(event);
if ( data->keyboard.state == MPK_PRESS )
printf( "key %d pressed\n", data->keyboard.key );
}
|
mpkWindowOpenDisplay( window );
GLXFBConfig *fbconfig = mpkWindowChooseFBConfig( window, &n );
mpkWindowSetFBConfig( window, fbconfig[0] );
mpkWindowCreateDrawable( window );
mpkWindowMapDrawable( window );
|
mpkWindowDestroyDrawable( window );
mpkWindowCloseDisplay( window );
mpkWindowSetParent( window, NULL );
mpkWindowSetScreen( window, 0 );
mpkWindowSetFBConfig( window, NULL );
|
MPKPipe *p = mpkWindowGetPipe(window);
Display *display = XOpenDisplay( mpkPipeGetDisplayName(p) );
mpkWindowSetDisplay( window, display );
mpkWindowSetScreen( DefaultScreen(display) );
mpkWindowUpdatePixelViewport( window );
|
MPK_WATTR_HINTS_DRAWABLE attribute is set to MPK_GLX_PIXMAP and a Pixmap has been specified via mpkWindowSetPixmap() then mpkWindowCreateDrawable will use glXCreateGLXPixmap(3G) on the specified Pixmap.window's Drawable and Pixmap.window's drawable, if the MPK_WATTR_HINTS_DRAWABLE attribute is set to MPK_GLX_WINDOW. Otherwise it simply returns.MPK_WATTR_HINTS_DIRECT attribute.window's GLXContext.window's GLXContext to its Drawable.window's current GLXContext.MPK_WATTR_HINTS_DOUBLEBUFFER attribute is not set to 0.display.display. Note that this display is used by MPK from the application thread. This means that in fork execution mode the Display has to be opened from the application process, not from the window rendering process.parent. This information is used by mpkWindowCreate() when creating the X11 Window and mpkWindowUpdatePixelViewport() when computing the pixel viewport of the MPKWindow from its fractional viewport.screen.nitems returns the number of elements in the list. Use XFree to free the memory returned by this function.MPK_WATTR_HINTS_DRAWABLE attribute is set to MPK_GLX_PIXMAP.| # window FIELDS description | |
| name | "window-name" |
| runon | processor-id |
| viewport | [ xf, yf, wf, hf ] |
| # window ATTRIBUTES description | |
| attributes { attributes description } | |
| # window CHANNELS description | |
| channel { channel-1 description } | |
| channel { channel-2 description } | |
| ... |
| hints | { window-attribute hints description } |
| planes | { window-attribute planes description } |
| transparent | { window-attribute transparent description } |
| visual | visual-type |
| drawable | drawable-type |
| caveat | visual-caveat |
| direct | y/n |
| thread | y/n |
| xinerama | y/n |
| event | none/input/inputOutput |
| decoration | y/n |
| transparent | y/n |
| X-renderable | y/n |
| rgba | y/n |
| doublebuffer | y/n |
| stereo | y/n # quad-buffer only |
| largest | y/n # pbuffer only |
| preserved | y/n # pbuffer only |
| level | 0 |
| depth | 1 |
| stencil | 0 |
| samples | 0 |
| auxiliary | 0 |
| color | 0 |
| rgba | [ 1, 1, 1, 0 ] |
| accum | [ 0, 0, 0, 0 ] |
| index | 0 |
| rgba | [ 0, 0, 0, 0 ] |
viewport parameters are relative to the parent pipe display size, and therefore their values should be in the range 0.0 to 1.0visual attribute hint specification accepts only the following File Format identifiers: true-color [default], pseudo-color, direct-color, static-color, static-gray or grayscale.drawable attribute hint specification accepts only the following File Format identifiers: none, window [default], pbuffer and pixmap.caveat attribute hint specification accepts only the following File Format identifiers: none [default], slow and non-conformant.MPKChannel, MPKConfig, MPKGlobal, MPKPipe