Re: [osg-users] Overriding the SwapBuffers call
Hello André, This looks fine. Try setting a breakpoint in GraphicsWindowWin32::swapBuffersImplementation() to see in what state the object is. Either _realized is false or the handle to the device context is invalid (and this is not trapped by the ::SwapBuffers call as an error). I'll try that on Monday. I already traced through the GraphicsWindowWin32::createWindow() method and all looked fine (after getting the window classes registered as I mentioned before). I assume you do not see anything reported on the console after the call (other than you own traces). That's correct. I'll investigate more on Monday. Thanks for the help. BTW, I don't know if you've seen the thread, but could you bring your insight (as Win32 implementer) in the Viewer on single screen - other screen black? thread? I think we've hit an inconsistency between how Windows and Linux handle full screen on a single screen, but before we go implementing workarounds, I'd like to be sure we're not just overlooking something. Thanks. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] Overriding the SwapBuffers call
Hi Jean-Sébastien, I'll try that on Monday. I already traced through the GraphicsWindowWin32::createWindow() method and all looked fine (after getting the window classes registered as I mentioned before). BTW, I don't know if you've seen the thread, but could you bring your insight (as Win32 implementer) in the Viewer on single screen - other screen black? thread? I think we've hit an inconsistency between how Windows and Linux handle full screen on a single screen, but before we go implementing workarounds, I'd like to be sure we're not just overlooking something. Thanks. Yep, saw it and it's still in my inbox waiting for some available time to get to the bottom of it (same for your other comment about the window classes registration). Meanwhile if you can provide more information about your setup for the black-screen issue (i.e. your screens configuration, what values you use in the traits structure, etc.) that would likely be helpful. André -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: February-16-08 8:30 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Overriding the SwapBuffers call Hello André, This looks fine. Try setting a breakpoint in GraphicsWindowWin32::swapBuffersImplementation() to see in what state the object is. Either _realized is false or the handle to the device context is invalid (and this is not trapped by the ::SwapBuffers call as an error). I'll try that on Monday. I already traced through the GraphicsWindowWin32::createWindow() method and all looked fine (after getting the window classes registered as I mentioned before). I assume you do not see anything reported on the console after the call (other than you own traces). That's correct. I'll investigate more on Monday. Thanks for the help. BTW, I don't know if you've seen the thread, but could you bring your insight (as Win32 implementer) in the Viewer on single screen - other screen black? thread? I think we've hit an inconsistency between how Windows and Linux handle full screen on a single screen, but before we go implementing workarounds, I'd like to be sure we're not just overlooking something. Thanks. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Overriding the SwapBuffers call
HI J-S, Simply assign your custom GraphicsWindow implementation to the viewer's osg::Camera's directly, rather than rely upon View::setUpView*() methods. Robert. On Fri, Feb 15, 2008 at 3:27 PM, Jean-Sébastien Guay [EMAIL PROTECTED] wrote: Hello Robert et al, I have a very specific application in which I need to wrap the SwapBuffers call with two other function calls. So for example, in GraphicsWindowWin32: void GraphicsWindowWin32::swapBuffersImplementation() { if (!_realized) return; // function call 1 here if (!::SwapBuffers(_hdc)) { // ... } // function call 2 here } What I would like to know is: - If I subclass GraphicsWindowWin32, how do I tell osgViewer::CompositeViewer to use my subclass instead of the real GraphicsWindowWin32 when creating a graphics window? - Will this catch all cases of calling SwapBuffers? I haven't seen it called directly anywhere else, but I could have missed something? Even SwapBuffersOperation seems to call this (indirectly) or am I wrong? Thanks in advance, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Overriding the SwapBuffers call
Hi Jean-Sébastien, Looks like the constructor of the base class (GraphicsWindowWin32) is not being called by your derived class (_realized is false). André -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: February-15-08 3:39 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Overriding the SwapBuffers call Hi Robert, Windows gurus, Simply assign your custom GraphicsWindow implementation to the viewer's osg::Camera's directly, rather than rely upon View::setUpView*() methods. I've gotten this to work partially. My method is getting called, but I get only black onscreen. My overridden swapBuffersImplementation looks like: virtual void MyGraphicsWindowWin32::swapBuffersImplementation() { std::cout Before SwapBuffers std::endl; osgViewer::GraphicsWindowWin32::swapBuffersImplementation(); std::cout After SwapBuffers std::endl; } Am I missing anything? As I said, the prints are in the console, but the screen stays black. Thanks in advance, P.S. For anyone who would need to do this in the future, for Win32 the Win32WindowingSystem does some work in its createGraphicsContext() method, and if this is not done, any call to GraphicsWindowWin32::createWindow() will fail. So you need to call osg::GraphicsContext::createGraphicsContext(traits.get()); once (even if you don't keep the return value), which sets things up so the custom window can be created directly afterwards. I hope this can save someone else the frustration I experienced trying to get my custom GraphicsWindow to be created correctly... :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Overriding the SwapBuffers call
Hi again, Am I missing anything? As I said, the prints are in the console, but the screen stays black. After further investigation, pressing 's' to display the stats displays them, but they don't get cleared so they just draw overtop the old image. Seems some clearing is not happening, in addition to the scene not getting displayed... I'm pretty lost, but then again I've never done this kind of stuff before either. Any advice would be appreciated... Thanks in advance, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] Overriding the SwapBuffers call
Hi Robert, Windows gurus, Simply assign your custom GraphicsWindow implementation to the viewer's osg::Camera's directly, rather than rely upon View::setUpView*() methods. I've gotten this to work partially. My method is getting called, but I get only black onscreen. My overridden swapBuffersImplementation looks like: virtual void MyGraphicsWindowWin32::swapBuffersImplementation() { std::cout Before SwapBuffers std::endl; osgViewer::GraphicsWindowWin32::swapBuffersImplementation(); std::cout After SwapBuffers std::endl; } Am I missing anything? As I said, the prints are in the console, but the screen stays black. Thanks in advance, P.S. For anyone who would need to do this in the future, for Win32 the Win32WindowingSystem does some work in its createGraphicsContext() method, and if this is not done, any call to GraphicsWindowWin32::createWindow() will fail. So you need to call osg::GraphicsContext::createGraphicsContext(traits.get()); once (even if you don't keep the return value), which sets things up so the custom window can be created directly afterwards. I hope this can save someone else the frustration I experienced trying to get my custom GraphicsWindow to be created correctly... :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] Overriding the SwapBuffers call
Hello André, Looks like the constructor of the base class (GraphicsWindowWin32) is not being called by your derived class (_realized is false). Here is my whole class (no joke!): class MyGraphicsWindowWin32 : public osgViewer::GraphicsWindowWin32 { public: MyGraphicsWindowWin32 (osg::GraphicsContext::Traits* traits) : osgViewer::GraphicsWindowWin32(traits) { } virtual void swapBuffersImplementation() { std::cout Before SwapBuffers std::endl; osgViewer::GraphicsWindowWin32::swapBuffersImplementation(); std::cout After SwapBuffers std::endl; } }; So I would assume the base class constructor is being called? J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] Overriding the SwapBuffers call
Hi Jean-Sébastien, This looks fine. Try setting a breakpoint in GraphicsWindowWin32::swapBuffersImplementation() to see in what state the object is. Either _realized is false or the handle to the device context is invalid (and this is not trapped by the ::SwapBuffers call as an error). I assume you do not see anything reported on the console after the call (other than you own traces). André -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: February-15-08 7:21 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Overriding the SwapBuffers call Hello André, Looks like the constructor of the base class (GraphicsWindowWin32) is not being called by your derived class (_realized is false). Here is my whole class (no joke!): class MyGraphicsWindowWin32 : public osgViewer::GraphicsWindowWin32 { public: MyGraphicsWindowWin32 (osg::GraphicsContext::Traits* traits) : osgViewer::GraphicsWindowWin32(traits) { } virtual void swapBuffersImplementation() { std::cout Before SwapBuffers std::endl; osgViewer::GraphicsWindowWin32::swapBuffersImplementation(); std::cout After SwapBuffers std::endl; } }; So I would assume the base class constructor is being called? J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org