Re: [osg-users] Clearing window client area.

2011-01-15 Thread Guy Volckaert
Now I understand! That makes perfect sense to me now.

I tried calling GraphicContext::setClearMask(GL_COLOR_BUFFER_BIT) in my app and 
now it works as expected. 

Thanks... your the best.

Guy

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35663#35663





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


Re: [osg-users] Clearing window client area.

2011-01-15 Thread Jean-Sébastien Guay

Hi Guy,


I guess I could have been a little clearer in my description. So here's an 
example that should help:


You're right, the description you gave this time makes things a lot clearer.

The camera will only clear its viewport. And that makes sense, since the 
camera should only ever affect pixels inside its viewport...


Even though after swap buffers, the context's clear() method is called 
as you've seen (good that you went to look at the code BTW, great 
initiative), the context does not do any clear because, as you can see 
in the doc of GraphicsContext::setClearMask() :


"Set the clear mask used in glClear(). Defaults to 0 - so no clear is 
done by default by the GraphicsContext, instead the Camera's attached 
the GraphicsContext will do the clear. GraphicsContext::setClearMask() 
is useful for when the Camera's Viewports don't conver the whole 
context, so the context will fill in the gaps."


So there you have it, a solution to your problem :-)

(note, "[...] the Camera's attached the GraphicsContext [...]" should 
read "[...] the Cameras attached to the GraphicsContext [...]", I should 
probably submit that correction to Robert :-) )


Note that if you set the context's clear mask to a non-zero value, you 
could then set the camera's clear mask to 0. No sense in clearing the 
whole context, and then clearing the camera's viewport a second time... 
Unless you want them cleared to a different color, or to clear different 
parts of the buffer.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Clearing window client area.

2011-01-14 Thread Guy Volckaert
I guess I could have been a little clearer in my description. So here's an 
example that should help:

1) I have a osg::camera of size 640x480. So the window's client area is 
640x480, or GraphicsContext::Trats::(x,y,width,height) = (0, 0, 640, 480).
2) The GL viewport of this camera is 320x240, i.e osg::Camera::setViewport(0, 
0, 320, 240).
3) When I render the scene, the windows area outside the GL viewport is not 
cleared.

Note that I set the osg::Camera::setClearMask(GL_COLOR_BUFFER_BIT | 
GL_DEPTH_BUFFER_BIT);

I found that context should be clear via the following function: 


Code:

void SwapBuffersOperation::operator () (GraphicsContext* context)
{
context->swapBuffersImplementation();
context->clear();
}




But for some reason, it doesn't. I'll try to modify one of the examples and see 
if the problem occurs as well. 

Guy

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35659#35659





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


Re: [osg-users] Clearing window client area.

2011-01-14 Thread Jean-Sébastien Guay

Hello Guy,


I have a stituation where the viewport is smaller than the windows, causing the 
region outside the viewport to not be cleared properly. Does anyone know how to 
clear the background window?


By viewport do you mean osg::View? And by window do you mean context? If 
so then just create another view that covers the whole context, set its 
camera's clear color to the color you want, the camera's render order to 
be before the other view's camera, and keep its scene data empty. It 
will just do a glClear of the whole context. You can then disable clear 
on the other view's camera to save a bit of time.


But if you mean you want to clear a Win32 window and your graphics 
context doesn't cover the whole window, then I wouldn't know. Sorry.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org