[osg-users] [build] How to open OSG in a CView MFC ?

90 views
Skip to first unread message

Nemo Ulysse

unread,
Oct 3, 2009, 7:23:26 AM10/3/09
to osg-...@lists.openscenegraph.org
Hi,

I have an MFC application with tow CView, I would like to use osg in those view to manipulate the display model with MFC window.
I am a complete beginner with OSG and after a long time of research I still don’t fin the way to do it.

Should I resize my osg window and put it over the CView or make the osg as child of the CView?
And how to do it?

Please give me some tips or some indication on what should I look for.
An example will be the best.

Thank you

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

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

Ümit Uzun

unread,
Oct 3, 2009, 11:29:40 AM10/3/09
to osg-...@lists.openscenegraph.org
Ni Nemo,

There is osgViewerMFC example in the source, and firstly you should get the rendering way by scratching the codes. And then you can implement your with same way. There is not much example on MFC, so your only chance is osgViewerMFC I think.

Regards.

Ümit Uzun


2009/10/3 Nemo Ulysse <ulysse...@gmail.com>

Nemo Ulysse

unread,
Oct 3, 2009, 12:09:00 PM10/3/09
to osg-...@lists.openscenegraph.org
Hi
Thanks’ for your answer
I already work on this example but the 3d model is open in full screen and I don’t manage to change that.
Hi
Thanks’ for your answer
I already work on this example but the 3d model is open in full screen and I don’t manage to change that.
I sougth that the window parameters was set there

// Setup the traits parameters
traits->x = 0;
traits->y = 0;
traits->width = rect.right - rect.left;
traits->height = rect.bottom - rect.top;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->inheritedWindowData = windata;

but I change it and nothing hapen

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=17838#17838

Ümit Uzun

unread,
Oct 3, 2009, 6:42:09 PM10/3/09
to osg-...@lists.openscenegraph.org
Hi Nemo,

Did you use osg::DisplaySettings to open up multisampling for antialiasing? If you answer yes, remove multisampling support or reduce the multisampling rate.

Regards.

Ümit Uzun


2009/10/3 Nemo Ulysse <ulysse...@gmail.com>
Hi

Nemo Ulysse

unread,
Oct 5, 2009, 6:12:32 AM10/5/09
to osg-...@lists.openscenegraph.org
Hi,

no I do not us osg::DIsplaySetting.

but as I didn't have the file osgViewer/StataHanler in the instalation of osg and do not manage to instal it.
I delete the EventHandler, do you think that it could be the reason why when I
use
m_G = new osgViewer::GraphicsWindow;
m_G-> setWindowRectangle(100, 100, 200, 200);

it don't do anything ?

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=17876#17876

Ümit Uzun

unread,
Oct 5, 2009, 6:31:34 AM10/5/09
to osg-...@lists.openscenegraph.org
Hi Nemo,

I ask DisplaySetting configuration because of some system hardware not support more multisampling and sometimes viewer open up in full screen. Your suspect about stateHandler does not cause this problem. But you should check your m_hWnd. It should be right handler for your CView. Because base parameters to create rendering window boundaries are got from m_hWnd.

Regards. Good Luck.

Ümit Uzun


2009/10/5 Nemo Ulysse <ulysse...@gmail.com>

Nemo Ulysse

unread,
Oct 5, 2009, 1:12:10 PM10/5/09
to osg-...@lists.openscenegraph.org
I am sorry but I don’t understand what you mean by right handler?

And I was wondering if there was a bug from my computer because,
Apparently the MFC example is suppose to do what I want like that:
http://forum.openscenegraph.org/viewtopic.php?t=2267&highlight=

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=17910#17910

Cory Riddell

unread,
Oct 5, 2009, 2:29:40 PM10/5/09
to osg-...@lists.openscenegraph.org
Hi Nemo,

Nemo Ulysse wrote:
> I already work on this example but the 3d model is open in full screen and I don’t manage to change that.
>

Are you saying the example program is doing what you want, except you
don't want the view to be maximized? If you click on the restore button,
do you get the window layout that you are looking for?

Cory

Nemo Ulysse

unread,
Oct 6, 2009, 3:33:10 AM10/6/09
to osg-...@lists.openscenegraph.org
Hi Cory

No it don’t do what I want.

In fact the CMDIChildWnd in which the 3D scene should be open is at the good place
But the 3D scene is not in the CMDIChildWnd
If I do a ctrl+tab I have this result :

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=17935#17935

screen.jpg

Nemo Ulysse

unread,
Oct 6, 2009, 5:40:49 PM10/6/09
to osg-...@lists.openscenegraph.org
Resolution of the problem:
If someone has the same problem as me, fallow this explication:


http://www.openscenegraph.org/projects/osg/changeset/7152

for me it work

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=17987#17987

Reply all
Reply to author
Forward
0 new messages