You could query OpenGL during the draw traversal, note the result, then modify the scene graph during the subsequent update traversal (if you can accept the 1-frame latency). Note that while you have a single update traversal per frame, you could have potentially multiple draw traversals per frame, each with different contexts. Querying each context could, potentially, yield different results. To be robust, your code will need to operate in such heterogeneous environments. You might look at OcclusionQueryNode for an example, though it's somewhat complex. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com <http://www.skew-matrix.com/> +1 303 859 9466
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erik Johnson Sent: Monday, August 18, 2008 5:54 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] update callback versus drawcallback Hello, I'm under the general assumption that: a) The openGL context is only valid during the Viewer::Frame (maybe during realize?) and all context-sensitive calls should happen during this draw time. b) Modifying the scene graph during the draw time is bad. c) Modifying the scene graph during the update callback is good; update callback doesn't have a valid OpenGL context. My question is, how does one add openGL context-sensitive hierarchy to an existing scenegraph at runtime? For example, lets say based on a keypress, I want to query some openGL extentions, create some vertex buffers, build a little scene graph, and add this to the scene root. What is the best practice for doing this? Thanks for any insight! Erik Johnson
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org