[osg-users] background color fills all the window (not only the given viewport)

Robert Osfield robert.osfield at gmail.com
Wed Mar 25 09:30:07 PDT 2009


Hi Fred,

Perhaps you are expecting too much from a graphics context.  Is that you
just want the graphics context to cover a small part of your window and want
conventional 2D GUI in the rest of the window?  I don't believe this is
possible without creating a subwindow just for the graphics context.

Robert.


On Wed, Mar 25, 2009 at 3:28 PM, Frederic Marmond <fmarmond at gmail.com>wrote:

> hum, the (black) color was not the problem in itself :)
>
> If I do this (update from my whole code):
>         gc->setClearColor( osg::Vec4f(1.2f, 0.2f, 0.6f, 1.0f) );
>        gc->setClearMask( 0) ;
>
>         camera->setClearColor( osg::Vec4f(0.2f, 0.2f, 1.6f, 1.0f) );
>        camera->setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
> (that's to say: don't clear anything on gc, and fill background with
> blue on camera),
>
> I have the camera successfully drawn at the right place, with blue
> background. This is what I want for that camera.
> BUT, the problem persists, i.e. all around the viewport, the whole
> window is painted in black. (maybe mick jagger is singing too loud ?).
> it is painted in pink if I enable the
> gc->setClearMask(GL_COLOR_BUFFER_BIT).
>
> I can't manage to make OSG only impact the camera viewport (my blue
> rectangle) and leave the window around unchanged...
> Did anyone achieve to display an osgViewer::Viewer at some small place
> in a window without overwrite window content around?
>
> Fred
>
>
>
> 2009/3/25 Robert Osfield <robert.osfield at gmail.com>:
> > On Wed, Mar 25, 2009 at 3:03 PM, Frederic Marmond <fmarmond at gmail.com>
> > wrote:
> >>
> >> hum, it didn't work :(
> >>
> >> both
> >> //      gc->setClearColor( osg::Vec4f(1.2f, 0.2f, 0.6f, 1.0f) );
> >> //      gc->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
> >> and
> >>        gc->setClearColor( osg::Vec4f(1.2f, 0.2f, 0.6f, 1.0f) );
> >>        gc->setClearMask( 0 );
> >>
> >> do the same: instead of the shiny pink color, the window is filled with
> >> black
> >>
> >> any other suggestion ?
> >
> > Well you disable the clear colour in the camera's ClearMask so perhaps
> this
> > is why it's just black.
> >
> > Robert.
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090325/988d209a/attachment-0003.htm>


More information about the osg-users mailing list