Hi,
You need these two threads to have shared context.
One context you already have in your window/pipe, so
you need to create shared context to in your thread.
Here how it is implemented in one of our projects:
#include <eq/client/window.h>
#ifdef AGL
# include <eq/client/aglWindow.h>
#endif
#ifdef GLX
# include <eq/client/glXWindow.h>
#endif
#ifdef WGL
# include <eq/client/wglWindow.h>
#endif
// ASYNCHRONOUS FRIEND FUNCTIONS
/
*=
=
=
=
=
=
=
=
=
=
=
=
======================================================================*/
#define glewGetContext glWindow->glewGetContext
// Asynchronous thread to process MBlocks
void *ActivateMBlocksAsync( void* ptr )
{
SinglePass* singlePass = ( SinglePass* )ptr;
// Initialization of context
EQASSERT( singlePass->mState );
eq::Window* wnd = singlePass->mState->getSharedContextWindow();
EQASSERT( wnd );
// store old drawable of window and set window's drawable to FBO,
// create another glWindow and restore original drowable
const int32_t drawable = wnd-
>getIAttribute( eq::Window::IATTR_HINT_DRAWABLE );
if( drawable != eq::FBO )
wnd->setIAttribute( eq::Window::IATTR_HINT_DRAWABLE, eq::FBO );
const int32_t stencil = wnd-
>getIAttribute( eq::Window::IATTR_PLANES_STENCIL );
if( stencil != 0 )
wnd->setIAttribute( eq::Window::IATTR_PLANES_STENCIL, 0 );
const eq::Pipe* pipe = wnd->getPipe();
eq::GLWindow* glWindow = 0; // new invisible window for shared
context
switch( pipe->getWindowSystem( ))
{
#ifdef GLX
case eq::WINDOW_SYSTEM_GLX:
EQINFO << "Using GLXWindow" << std::endl;
glWindow = new eq::GLXWindow( wnd );
break;
#endif
#ifdef AGL
case eq::WINDOW_SYSTEM_AGL:
EQINFO << "Using AGLWindow" << std::endl;
glWindow = new eq::AGLWindow( wnd );
break;
#endif
#ifdef WGL
case eq::WINDOW_SYSTEM_WGL:
EQINFO << "Using WGLWindow" << std::endl;
glWindow = new eq::WGLWindow( wnd );
break;
#endif
default:
EQERROR << "Window system " << pipe->getWindowSystem()
<< " not implemented or supported" << endl;
return 0;
}
EQASSERT( glWindow );
if( !glWindow->configInit( ))
{
EQWARN << "OS Window initialization failed: " << endl;
delete glWindow;
return 0;
}
if( drawable != eq::FBO )
wnd->setIAttribute( eq::Window::IATTR_HINT_DRAWABLE,
drawable );
if( stencil != 0 )
wnd->setIAttribute( eq::Window::IATTR_PLANES_STENCIL,
stencil );
glWindow->makeCurrent();
glWindow->initGLEW();
EQWARN << "Async heights fetcher initialization finished" <<
std::endl;
// release main thread, after initialization is finished
singlePass->mInitMutex.unset();
while... // Do you async stuff here
// deinit context ( glWindow )
if( glWindow )
{
if( drawable != eq::FBO )
wnd->setIAttribute( eq::Window::IATTR_HINT_DRAWABLE,
eq::FBO );
glWindow->configExit( ); // mb set window to 0 before that?
delete glWindow;
glWindow = 0;
if( drawable != eq::FBO )
wnd->setIAttribute( eq::Window::IATTR_HINT_DRAWABLE,
drawable );
}
return 0;
}
HTH,
Maxim Makhinya
On Apr 6, 2010, at 10:58 , chuwy wrote:
>
> Hi,
>
> i want to display multiple objects contained in a display list each.
> During
> runtime the representation for an object can change and i want to
> change the
> display list for it and display the old list until the new is
> generated.
>
> is it possible to create display lists not insidre the frameDraw or
> an idle
> function, but in parallel to rendering?
>
> Thanks for your help!
> --
> View this message in context:
> http://n2.nabble.com/rendering-and-generating-display-lists-in-parallel-tp4857846p4857846.html
> Sent from the Equalizer - Parallel Rendering mailing list archive at
> Nabble.com.
>
> _______________________________________________
> eq-dev mailing list
> [email protected]
> http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
> http://www.equalizergraphics.com
>
_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com