I have solved my own problem. My fail was in not calling properly the
GDI windows function SwapBuffers(m_hDC) and setting correctly the
ViewMatrix in the _sceneview. I solved some of my doubts like GetDC,
wglCreateContext, wglMakeCurrent, ReleaseDC, functions that anyone who
want to integrate OSG in WindowsForms must look on them. Thanks anyway I
think I can continue my project.
José Antonio Iglesias Guitián escribió:
Hi all OSG users,
I have encountered problems trying to render in a Windows Forms window
using OSG sceneview class.
I create a WindowsForms PictureBox component and obtain its handle in
a class that inherits from System::Windows::Forms::Form
hwnd = (HWND) this->pictureBox1->Handle.ToPointer();
I pass this handle, called hwnd as a parameter to my OSG as follows:
Osg = gcnew COpenSceneGraph(this, hwnd);
Inside the constructor of my OSG class I have the follow line:
m_hDC = GetDC(hwnd);
if (m_hDC)
{
MySetPixelFormat(m_hDC); //function to set up the pixel
format
HGLRC hglrc = wglCreateContext(m_hDC);
wglMakeCurrent(m_hDC, hglrc);
InitGL();
_sceneview->setSceneData(loadedModel.get());
_sceneview->setClearColor(osg::Vec4(0.0,1.0,0.0,1));
_sceneview->init();
}
In my render main function I call _sceneview->update() , cull() and
draw()
and the problem is that I cannot see anything in the pictureBox as a
result
of sceneview calls.
Has anybody tried something similar and knows what could be my error?
Thank you very much for help.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/