firstly: big thank you for this outstanding 3d engine!
background: we would like to add 3d features to a legacy mfc/c++ (mdi) industrial application. This application has a rich mfc gui => it would be too expensive to redevelop everyting with panda 2D & 3D…
The application has basic 3d opengl rendering features, but opengl apis are circonvoluted compared to panda3d apis (!!!).
=> panda3d looks like a great solution!
So we are currently working on a POC (Proof Of Concept) to ensure mfc/c++ + panda3d works well as claimed in the docs… but we are facing several issues
POC goal : create a MFC mdi application with hello world walking Ralf in each mdi window, release & debug mode (seems possible)
Environment: Visual Studio/VC++ 14.2 & mfc 2019 - windows sdk 10 - python 3.8.6 - panda3d 1.10.7 - windows 10 - 64 bits
-
Succesfully tested: rebuild “hello world” in release & debug mode (it rocks! breakpoints can be set)
This build uses Panda3d on-the-shelves SDK -
wizard created MDI MFC application + pandatest.cpp with subsequent modifications:
int main(int argc, char* argv) replaced by: int test_main()
test_main() is now “hello world” core in a c function. It’s called in a dedicated thread when a mdi child view is created to keep the main loop in background:
UINT MyThreadProc(LPVOID pParam)
{
// do something with ‘pObject’
//run_panda3d((unsigned long)pParam);
test_main();
return 0; // thread completed successfully
}
afx_msg int CMFCPanda3dView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
afx_msg int res = CView::OnCreate(lpCreateStruct);
AfxBeginThread(MyThreadProc, NULL);
return res;
}
release build and run: works like a charm!
debug: we rebuilt panda3d + python 3.8.6 in debug mode =>
- change included libraries in solution properties:
libp3framework_d.lib
libpanda_d.lib
libpandaexpress_d.lib
libp3dtool_d.lib
libp3dtoolconfig_d.lib
libp3direct.lib => this one is not rebuilt by the makepanda.bat - copy corresponding dlls from panda3d debug rebuilt folder to application debug folder
We’re currently stucked with:
- Exception thrown: read access violation. this was 0x50.
Call stack:
libpanda_d.dll!PointerToWindowHandle::OSHandle::operator WindowHandle::OSHandle *() Line 138 C++
libpanda_d.dll!EventParameter::is_empty() Line 96 C++
libp3framework_d.dll!WindowFramework::get_camera_group() Line 226 C++
MFCPanda3d.exe!test_main() Line 146 C++
MFCPanda3d.exe!MyThreadProc(void * pParam) Line 75 C++
Code:
/**
- We also have the typecast operator to automatically convert PointerTo’s to
- the required kind of actual pointer. This introduces ambiguities which the
- compiler will resolve one way or the other, but we don’t care which way it
- goes because either will be correct.
*/
template
constexpr PointerTo::
operator T * () const noexcept {
return (To *)(this->_void_ptr); => Exception
}
For information (to be diScussed later in details)
2) we tried to move forward in release mode to put the main panda3d window in the mdi view
=> memory error Access violation exception
- we tried to move forward in release mode. We put the “hello world” main loop core (CIntervalManager::get_global_ptr()->step()
in a view timer called method instead of a thread.
=> memory errorAccess violation exception
Do you faced similar issues???