[osg-users] Help:why does renderbin affect the display of textures ?

7 views
Skip to first unread message

wang shuiying

unread,
Oct 5, 2012, 12:18:23 PM10/5/12
to osg-...@lists.openscenegraph.org
Hello,

I have two drawable nodes A and B under the same main group node. I
mapped two different textures on the drawables respectively. Those two
drawables do not have any overlappings in terms of pixels on the screen.
Drawable A is described using open scene graph library while drawable B
is described using openGL terms. Depth test is disabled by Drawable A
and enabled by drawable B. Texture display on A uses a shader while B
does not.

When the renderbin of drawable A is set to be -1 and that of drawable B
is 1, the two textures cannot show at the same time. That is to say,
when I toggle on both drawable A and drawable B and make them both seen
on the screen, the texture on drawable B doesn't show, but the color of
B is correct. Under such circumstance, when I manipulate the view in a
way such that drawable A is out of sight, then the texture on drawable B
will appear.

If I reverse the renderbins of those two drawables, then the textures
can show at the same time.

I just cannot figure out why this happens.

If it is due to depth test, why should such conflicts happen, since
they have no overlapped pixels on the screen? Even it is due to depth
test, why is the color correct?

Would someone please be so kind enough as to explain that to me?

Thanks millions in advance!

Best regards
Shuiying

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

wang shuiying

unread,
Oct 8, 2012, 4:26:41 AM10/8/12
to osg-...@lists.openscenegraph.org
Is nobody interested in this question?:-(

Wang Rui

unread,
Oct 8, 2012, 4:33:24 AM10/8/12
to OpenSceneGraph Users
Hi Shuiying,

I guess that there may be something wrong in the draw implementation
of drawable B. Although OpenGL calls can be executable in custom
drawables, it is still suggested that you apply all kinds of rendering
states to the drawable using StateAttribute derivatives. But without
looking at some detailed code, I can hardly find out the actual reason
inside.

Wang Rui


2012/10/8 wang shuiying <shuiyi...@fu-berlin.de>:

Sergey Polischuk

unread,
Oct 8, 2012, 5:05:57 AM10/8/12
to OpenSceneGraph Users
Hi
Seems like you are messing with opengl state, and osg dont know about it. You should either:
a) when you draw something with pure gl - after you finished, return all state you modified to values being before you started drawing
b) use osg::State interface members to let osg know what state you are changed, or use osg wrappers in osg::State to make this state changes.
c) call osg::State's dirty*() methods (like dirtyAllModes() and dirtyAllAttributes()) for state you've changed, after you finished with pure gl, but i dont recommend using this.

Cheers.

08.10.2012, 12:14, "wang shuiying" <shuiyi...@fu-berlin.de>:

Reply all
Reply to author
Forward
0 new messages