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

2009-03-26 Thread Guy
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

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

2009-03-26 Thread Simon Hammett
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.

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

2009-03-26 Thread Robert Osfield
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

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

2009-03-26 Thread Simon Hammett
Yes I know. The magic is in the use of glAddSwapHintRectWIN which is a wgl function. I've just tested this and it works, so you can update part of the window using plain GDI calls and do the rest with opengl. Mind you I wouldn't trust it work on all machines. It's probably less of head ache to

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

2009-03-25 Thread Frederic Marmond
hello world, on a win32 project, I would like to display an osg Viewer in a part of the window. I set my osg::GraphicsContext::Traits with coords I want, set the inheritedWindowData with osgViewer::GraphicsWindowWin32::WindowData( hwnd ) my model is well placed and displayed (in the area I

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

2009-03-25 Thread Robert Osfield
Hi Fred, Just set the Camera's viewport so it only covers the part you want to render to. Robert. On Wed, Mar 25, 2009 at 2:06 PM, Frederic Marmond fmarm...@gmail.comwrote: hello world, on a win32 project, I would like to display an osg Viewer in a part of the window. I set my

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

2009-03-25 Thread Frederic Marmond
thanks Robert, I already did it (here is my test code): RECT rect; GetWindowRect(hwnd,rect); // Set window traits and gc m_Traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( hwnd

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

2009-03-25 Thread Robert Osfield
Hi Fred, Ahh you're code tells the story... You are enabling the graphics window clear by the line: gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); Just leave this in it's default value of 0 and it won't clear, the only clear that will happen is the camera's viewport clear.

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

2009-03-25 Thread Frederic Marmond
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

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

2009-03-25 Thread Frederic Marmond
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(

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

2009-03-25 Thread Robert Osfield
On Wed, Mar 25, 2009 at 3:03 PM, Frederic Marmond fmarm...@gmail.comwrote: 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,

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

2009-03-25 Thread Robert Osfield
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

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

2009-03-25 Thread Frederic Marmond
ha, thanks Robert, you've got it ! :) So I stop investigate in the OSG part, and will concentrate on windows API side... cheers! Fred 2009/3/25 Robert Osfield robert.osfi...@gmail.com: Hi Fred, Perhaps you are expecting too much from a graphics context.  Is that you just want the graphics