Hello again everyone!

I am currently developing an application with a company and we have a 
challenge.  We want our application to run over top of any other application. 
So in windows our app is basically several graphical elements that will react 
to input from sensors.  So to start with I wanted to see if I could get the 
cessna model to render to the screen and have nothing else.  

I figured I might be able to make use of the layered windows available from the 
win32 library.  Here is a good example of what I mean 
http://www.dhpoware.com/demos/glLayeredWindows.html

My understanding of how it works is fairly crude, but essentially they create a 
struct to represent an image and redraw it to the pbuffer and re render it to 
the layerd window.  Thus allowing the image to be the only thing that displays 
and nothing else of a window.

So I tried to embedd OSG into the transparent window but all that happens  is 
that the entire window is transparent.  I believe because the separate thread 
uses the hwnd handle to take care of the rendering.  So I cannot access the 
variables I need to re render the osg scene to the buffer. 

Is there a way to achieve this in osg? Have a model or a group of models 
displayed only on the scene. Also we want the "window" to not be clickable.  
this way the user can click through our window onto any application they have 
under it.  I realize I may be obscure here so if there is any confusion please 
ask me and Ill do my best to explain!  

Thanks!

I also tried to get a similar effect using OSG's api to the inherited window 
data.   To no avail:



Code:
LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        PAINTSTRUCT ps;
        HDC hdc;
        TCHAR greeting[] = _T("Hello, World!");

        switch (msg)
        {
                case WM_CREATE:
                {
                        osg::ref_ptr<osg::Referenced> windata =
                                new 
osgViewer::GraphicsWindowWin32::WindowData(hWnd);
                        
                        osg::ref_ptr<osg::GraphicsContext::Traits> traits =
                                new osg::GraphicsContext::Traits;
                        traits->x = 0;
                        traits->y = 0;
                        traits->width = 800;
                        traits->height = 600;
                        traits->windowDecoration = false;
                        traits->doubleBuffer = true;
                        traits->inheritedWindowData = windata;
                        traits->alpha = false;

                        osg::ref_ptr<osg::GraphicsContext> gc =
                                
osg::GraphicsContext::createGraphicsContext(traits.get()
                                );
                        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
                        camera->setGraphicsContext(gc);
                        camera->setViewport(
                                new osg::Viewport(0, 0, traits->width, 
traits->height));
                        camera->setClearMask(GL_DEPTH_BUFFER_BIT );
                        camera->setClearColor(osg::Vec4f(0,0,0,0));
                        camera->setProjectionMatrixAsPerspective(
                                30.0f, (double)traits->width / (double)traits
                                ->height, 1.0, 1000.0);
                        g_viewer = new osgViewer::Viewer;
                        g_viewer->setCamera(camera.get());
                        
g_viewer->setSceneData(osgDB::readNodeFile("cessna.osg"));
                        g_viewer->setKeyEventSetsDone(0);
                        g_viewer->setCameraManipulator(
                                new osgGA::TrackballManipulator);
                        g_finished = false;

                        

                
                        
                        _beginthread(render, 0, NULL);

                        
                        return 0;
                }

                case WM_PAINT:
                                
                        break;

                case WM_DESTROY:
                        g_viewer->setDone(true);
                        while (!g_finished) Sleep(10);
                        PostQuitMessage(0);
                        return 0;
        }
}

[/url]

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to