integrate ogre and ofw

Hi guys,

I try to integrate ogre1.71 and ofw0.60 together recently.
For ogre can render glcontext on existing hwnd.
so i thought if i can try to render it on ofw gl context.
here is my code in ogre.
mWindow = mRoot->initialise(false);
Ogre::NameValuePairList parms;

HWND wnd = WindowFromDC(wglGetCurrentDC());

//parms[“externalGLControl”]= Ogre::StringConverter::toString((unsigned long)wnd);
parms[“externalGLContext”]= Ogre::StringConverter::toString((unsigned long)wnd);

//??wnd?ofAppGlutWindow,??HWND wnd = WindowFromDC(wglGetCurrentDC())??

mWindow = mRoot->createRenderWindow(“GLUT”, 1024, 768, false, &parms);

but it doesn’t work out, the glut window crashed. i’ve debugged a while, and can’t find why.
Does any one has similiar issue?

i just found this:

http://forum.openframeworks.cc/t/l/48031/0">http://www.ogre3d.org/forums/http://forum.openframeworks.cc/t/l/48031/0

and the code they’re using is:

  
root->initialise( false, "no default" );  
params["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned int)myHWND);  
params["externalGLControl"] = Ogre::StringConverter::toString( (true) );  
params["externalGLContext"] = Ogre::StringConverter::toString( (myHGLRC) );  
my_render_window = ->createRenderWindow( title, MY_DEFAULT_WINDOW_WIDTH, MY_DEFAULT_WINDOW_HEIGHT, false, &params );  

hope this helps,
d

thanks, actually I’ve test the similar cood before, but it doesn’t work out:

params[“externalWindowHandle”] = Ogre::StringConverter::toString((unsigned int)openglWindow);
params[“externalGLControl”] = Ogre::StringConverter::toString( true );
params[“externalGLContext”] = Ogre::StringConverter::toString( (unsigned
int)wglGetCurrentContext() );

when i comment “externalWindowHandle”, “externalGLContext” ogre will draw the window before openframeworks. the problem is whatever drawing code written in testApp:draw() will never work.

So I’ve search something about sharing GLContext, but doesn’t get what i want. :!: :!:

Anyway, i can use the openframeworks addon codes…