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

Frederic Marmond fmarmond at gmail.com
Wed Mar 25 08:28:34 PDT 2009

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) );
(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?


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

More information about the osg-users mailing list