Hi Guy,

 

>From what I’ve seen osgWidget would be an overkill for us, while not 
>implementing the features we do need.

 

In any case, I’ve quickly looked into osgWidget source code, and it seems it’s 
using a single transparent bin with z ordering (WindowManager.cpp, around line 
400, assigns different z values to windows when changing the focus of a window).

 

This is currently what we are doing, but I’ve found it very error prone in our 
case.

 

Cheers,

 

Tanguy

 

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Guy
Sent: Thursday 02 April 2009 12:28
To: OpenSceneGraph Users
Subject: Re: [osg-users] Controlling the rendering order

 

Maybe you should look at osgWidget which handles GUI elements.

 

Guy.

 

________________________________

מאת: [email protected] 
[mailto:[email protected]] בשם Tanguy Fautre
נשלח: Thursday, April 02, 2009 2:27 PM
אל: OpenSceneGraph Users
נושא: Re: [osg-users] Controlling the rendering order

 

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: [email protected] 
[mailto:[email protected]] 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 <[email protected]> 
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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to