Open goforbroke1006 opened 11 months ago
Hi!
I cannot reproduce. Your example worked out of the box.
Your README says:
bash ./install-ogre-next.sh
But since there was no install-ogre-next.sh I just did the following:
Place OgreNext into third_party/ogre-next
Modify CMakeLists with the following:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86508d0..d74c596 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,9 @@ endif (LINUX)
-find_package(OGRE 2.3.3 REQUIRED COMPONENTS Bites RTShaderSystem)
+#find_package(OGRE 2.3.3 REQUIRED COMPONENTS Bites RTShaderSystem)
+set(OGRE_INCLUDE_DIRS "/home/matias/hello-ogre-next/third_party/ogre-next/OgreMain/include" "/home/matias/hello-ogre-next/third_party/ogre-next/build/Debug/include")
+set(OGRE_LIBRARIES "/home/matias/hello-ogre-next/third_party/ogre-next/build/Debug/lib/libOgreMain_d.so")
target_include_directories(${PROJECT_NAME} PRIVATE ${OGRE_INCLUDE_DIRS})
message(OGRE_LIBRARIES = ${OGRE_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${OGRE_LIBRARIES})
And it worked.
It presented a black screen because you were missing the following line in C++:
compositorManager->addWorkspace( gSceneManager, gOgreWindow->getTexture(), camera, workspaceName,
true );
My bad. To install deps:
bash ./setup.sh
Problem code was in devel branch. Already added to branch main. The invocation of addWorkspace present, I see blue screen but can't create new scene node - got NULL
I do next steps:
On step 8 got null-pointer. If bug happens maybe need fix. If I did not folllow correct order of components initialization could be better got an error like "Create scene node failed: some component were not initialized".
Without nodes app started ok.
Hi!
The problem is in your CMakeLists.txt setup:
You have the following:
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Debug mode")
add_compile_definitions(OGRE_DEBUG_MODE)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Which should be (as suggested by OgrePlatform.h):
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Debug mode")
add_compile_definitions(DEBUG)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Otherwise you cause ABI incompatibilities. If you step inside the debugger in createChildSceneNode() call it ends up calling SceneNode::removeAndDestroyAllChildren
, which is why your mSceneNode ends up being a nullptr and crashes.
OgreNext 3.0 will come with ABI check tool to early-detect this type of errors.
Our CMake bootstrap script uses CMAKE_CXX_FLAGS_DEBUG instead. You can check it for reference if you want.
(See manual for more info on the EmptyProject template).
Yeah, it's working now. Thanks for help! For me it was a real entry threshold =)
But, before I modified CmakeList file I found "workaround" - I change this
auto *mSceneNode = sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)
->createChildSceneNode(Ogre::SCENE_DYNAMIC);
to this
auto *mSceneNode = (Ogre::SceneNode *) sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)
->createChild(Ogre::SCENE_DYNAMIC);
and app start without null-pointers.
Did not check with debugger, don't know details. Just decided to highlight this moment.
System Information
Detailled description
Scene Manager on createChildSceneNode returns NULL. https://github.com/goforbroke1006/hello-ogre-next/blob/devel/main.cpp Row 123
Ogre.log
Callstack