Hi opensg users, I work on a gesture based interaction technique, and I want to get the objects behind each point of my 2D gesture.
So I'm trying to make an "Identification buffer" so as to overcome the slowness of getObject() method (IntersectAcction) .(which take 6 secs for 300 points). So I make a deep clone of my root, and traverse it so as to replace all geometrie materials by a unique color coresponding to the node being drawn. After that, I render wy color-modified environement into an FBOViewport,and try to retreive the texture to the RAM. My personal getObject() method will retreive the color on this buffer to deduce the NodePtr behind the pixel. So my first question is maybe an OpenGL one. How to disable all GL states like GL_BLEND,GL_DITHER,GL_FOG,GL_LIGHTING,GL_TEXTURE_xD so as to draw only my color whithout the lighting model ? do I simply need to call glDisable() (if I do that, it segfaults at glReadPixels), and let opensg further re-enable them ? or can I set theses enums somewhere else? Or How can I switch to glShadeModel(GL_FLAT) ? I also read something about the BlendEquation(SRC COLOR / DEST COLOR) in the opengl specs, so as to don't apply lighting model, but I'have no idea on how to use it in OpenSG... I'm blocked by this color problem. Secondly, I add a TextureChunk to FBOViewport, and I attach an Image with no data to this texture chunk. Do I need to allocate this data before rendering so as to be sure to get results (experimentaly, there is no difference in my case) ? Then, I set the TextureChunk internal format to GL_INT, and I call glReadPixels with (.. GL_RGBA,GL_INT ..), I suppose it's the better choice for my case, but I'm not sure. If sombody can confirm.. Thirdly I retreive the buffer with glReadBuffer(0x8CE0), and I didn' found a method to get the real current GL_COLOR_ATTACHMENTx_EXT identification of the FBOViewport buffer. Does it exists a method for that ? (FboViewport seems to handle multiple buffers internaly, can I use them into a single FboViewport) ( I try some mad trick like win->getGLObjectId(getTextures(0)->getGLId()) but it doesn't seems to work.... ) thanks in advance for your response. Raphaƫl DUCOM PS : A the beginning, I try to derivate from RenderAction To dynamicaly assign new colors to objects just before them being drawn, while storing these <color/NodePtr> pairs in a map.... so as to avoid a deepCloning. but I lost myself in the code... I didn't understant how the tree is converted to OpenGL calls, ( at which moment the tree parsed to simplify glCalls, and how.. ). If somebody have some example around this problem, it would be the better ! ------------------------------------------------------------------------- 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
