> doesn't window->render() do a swap? How does your render_IDB() function look?
in the Window Class hierarchy, only ClusterWindow,PassiveWindow and
XWindow Classes implements the swap() method, so I believe that only
the glutSwapBuffer() call could really swap buffers of a GlutWindow.
(maybe swapping occurs more "deeply" in the rendering backend, but I
don't know where).
This is my rendering loop :
Note : I use one RenderAction/Viewport pair for the main rendering, an
one other for the ID rendering (ie: both are not the same instances -
I have try to do all the renderings with the same pair, but mysterious
errors happens (node seems to disappear between the getObject() method
and further stuff .. I also try to have muti_viewport in the same
window, and one RenderAct for each renderer, same issue )
display{
if(need_render_ID_buffer){
render_IDB();
need_render_ID_buffer=false;
}
window->render(renderaction);
myopenglstuff->render();
glutSwapBuffers();
}
render_IDB(){
// Save Olds viewports
MFViewportPtr tmp_save;
tmp_save.setValues(_window->getMFPort()->getValues() );
_window->getMFPort()->clear();
_grabber = GrabForeground::create();
beginEditCP(_grabber);
ImagePtr img = Image::create();
beginEditCP(img);
img->set(GL_RGBA,w,h);
endEditCP(img);
_grabber->setImage(img);
_grabber->setAutoResize(false);
_grabber->setActive(true);
endEditCP(_grabber);
_window->addPort(_ID_viewport);
_window->getPort(0)->getMFForegrounds()->push_back(_grabber);
switchToIDbuffer(); // The MaterialSwitch to color ID
_window->render(_ID_renderAction);
if(_grabber->getImage()->getData() != NULL)
_ID_buffer = _grabber->getImage()->getData();
switchToNormal();
// we remove the Grabber
MFForegroundPtr::iterator i =
_window->getPort(0)->getMFForegrounds()->find(_grabber);
if( i != _window->getPort(0)->getMFForegrounds()->end() ){
_window->getPort(0)->getMFForegrounds()->erase(i);
}
_window->getMFPort()->clear();
_window->getMFPort()->setValues(tmp_save.getValues());
}
Hopping sombody could help !
Raphael D.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users