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

Robert Osfield robert.osfield at gmail.com
Thu Mar 26 02:44:14 PDT 2009


HI Simon,

I'm afraid the OSG already uses the sissor test to make sure that the
viewport clear only affects the region of interest.  It work, but the
problem Fredric has really all about the fact that the OpenGL context
affects the whole window it's assigned to.

Robert.

On Thu, Mar 26, 2009 at 8:59 AM, Simon Hammett
<s.d.hammett at googlemail.com>wrote:

> This might be want you are looking for:
>
> http://factor-language.blogspot.com/2007_08_01_archive.html
>
> and
>
>
> http://factor-language.blogspot.com/2007/08/opengl-redraw-bug-on-windows.html
>
> Basically enable the scissor test, then tell OpenGl what part of the
> window to update when calling SwapBuffers.
>
> Not tried it myself though.
>
> 2009/3/26 Guy <guy at dvp.co.il>:
> > Frederic,
> >  I think you can't limit the OpenGL drawing to a limited region of a
> window HANDLE. You could embed a window in the region you want to use OGL,
> and just draw to it. Or you could first draw the OGL/OSG code, and then get
> the window handle and draw all your other stuff using GDI or whatever.
> >
> > Guy.
> >
> > ---------
> >
> >
> > 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
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
>
>
> --
> http://www.ssTk.co.uk
> _______________________________________________
> 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/20090326/846f3b91/attachment-0003.htm>


More information about the osg-users mailing list