Hi Robert,
Do you suggest I create an additional bin type (e.g. GUI_ELEMENT_BIN) in addition to OPAQUE_BIN and TRANSPARENT_BIN, and write my own sort algorithm for those (i.e. render in the same order children appears in) ? Would it be relatively easy to do so? The thing is I'm quite happy with the way OSG sorts nodes most of the time, but for GUI elements (at least in our case) there is no performance benefit to do so. Almost everything use the same states (blending on, no depth test/write, no lighting) while only the texture changes. Cheers, Tanguy From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Thursday 02 April 2009 11:59 To: OpenSceneGraph Users Subject: Re: [osg-users] Controlling the rendering order Hi Tanguy, The OSG sorts the objects in opaque bin to minimize state changes, this is crucial for performance - it's a pretty fundamental part to efficient rendering and standard practice in high performance graphics toolkts.. This does mean the ordering changes. You have complete control over the bins though, you can change the sort algorithm on them, you can create own bins, set the overall render order. Within a single geometry the order is drawn in the order that the primitives are placed in the geometry, so perhaps this is sufficient for your purposes. Robert. On Thu, Apr 2, 2009 at 11:02 AM, Tanguy Fautre <tang...@aristechnologies.com> wrote: Hi, When doing GUI elements in OpenGL, it's particularly useful to exactly control the rendering order. Usually, this goes like this: glDepthMask(0); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glEnable(GL_BLEND); /* Render GUI back to front */ /* Note that we use Z = 0.0 all the time */ glBegin(GL_QUADS); glVertex2f(x, y); /* ... */ It's very easy to do directly in OpenGL, but with OSG I've currently found it ridiculously hard. The reason is that OSG change to rendering order to optimize things (which is good in most cases, except this one). Is there any way to easily control the rendering order of nodes in OSG (e.g. set a node property to tell OSG to render children nodes in order)? I've found render bins to be over complicated to solve this (also they require the user to assign a unique and ordered id to each of them), and assigning a Z value to each GUI element is also tedious and error prone. Am I missing something? Cheers, Tanguy _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org