Add version guards and replace deprecated OGRE API usages (prepare ogre-1.12)#1283
Merged
Add version guards and replace deprecated OGRE API usages (prepare ogre-1.12)#1283
Conversation
Adds two version-floor compile definitions used by the subsequent
deprecated-API renames so they can keep an OGRE 1.9 fallback path:
OGRE_VERSION_LT_1_10_0 - <OgreVector.h>, getBones(),
GpuProgramParametersPtr were introduced in 1.10
OGRE_VERSION_LT_1_12_9 - HBU_GPU_ONLY/HBU_CPU_TO_GPU and the free
Ogre::HBU_* enum scope were introduced in 1.12.9
The existing _LT_1_11_0 and _LT_1_12_0 guards remain unchanged.
Generated-by: Claude Sonnet 4.6
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
OGRE 1.12.4 deprecated <OgreVector3.h> in favour of the consolidated <OgreVector.h>. The new header was introduced in 1.10, so guard the new include behind OGRE_VERSION_LT_1_10_0 to keep 1.9 building. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
Root::createSceneManager(SceneTypeMask) was deprecated in OGRE 1.10.9.
The replacement is createSceneManager("DefaultSceneManager"), which is
the string name equivalent of ST_GENERIC.
Generated-by: Claude Sonnet 4.6
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
OGRE 1.12.9 introduced HBU_GPU_ONLY / HBU_CPU_TO_GPU as a free-scope Ogre::HardwareBufferUsage enum, deprecating Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY in the same release. The 9 createVertexBuffer / createIndexBuffer call sites in OgreDynamicRenderable, OgreMeshFactory, OgreScene and OgreText use the modern names directly. To keep an OGRE 1.9 source-compat path we add a small internal-only compat header that, on OGRE < 1.12.9, defines the new identifiers as constexpr aliases for the old nested-scope values. On 1.12.9+ the aliases are not redeclared; the native enum is used as provided by upstream. Combines the original D4 (5c833bf) and its scope fix-up (d92b9cd) into a single guarded change so reviewers can see the full migration together with its 1.9 fallback. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
…arget
The internal GL render-system header OgreGLFBORenderTexture.h may not be
present when OGRE is installed as a package. The GLId() function only
uses getCustomAttribute("GLID", ...) which is a standard public OGRE API
and does not require the internal header. Replace GLuint with unsigned int
to eliminate the dependency entirely.
Generated-by: Claude Sonnet 4.6
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
…ster OGRE 1.10.3 deprecated resource lookups without an explicit group name. Pass Ogre::RGN_DEFAULT to make the lookup unambiguous and silence the deprecation warning from OGRE_RESOURCEMANAGER_STRICT. The two-argument getByName overload exists since OGRE 1.0 (the second arg has a default value), so this change is backwards-compatible with 1.9. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
Skeleton::getBones() and the std::vector-based bone container were introduced in OGRE 1.10. Older releases only expose Skeleton::getBoneIterator(); guard the modern range-for behind OGRE_VERSION_LT_1_10_0 and keep the iterator path available for 1.9. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
OGRE 1.10 introduced Ogre::GpuProgramParametersPtr (a std-pointer-based typedef) and deprecated GpuProgramParametersSharedPtr. The deprecated typedef remains available as an alias on 1.12 but emits a warning. Switch local variables that hold the result of getFragmentProgramParameters or getDefaultParameters to auto, which deduces to whichever name the installed OGRE provides — silent on both 1.9 and 1.12. Function signatures (OgreMaterial.hh::UpdateShaderParams, OgreHeightmap.cc::updateVpParams) keep the explicit GpuProgramParametersSharedPtr name to remain valid on 1.9, where GpuProgramParametersPtr is undefined. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
OGRE 1.12 requires RTSS for GL3Plus/GLES2, so materials may not have a technique with a fixed-function pass. In that case findSourceTechnique returns nullptr and calling removeShaderBasedTechnique(nullptr, ...) dereferences srcTech->getParent() and crashes. Guard against it. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
When OgreHeightmap relies on the stock TerrainMaterialGeneratorA (active in OGRE >= 1.11 builds, see follow-up commits) the active terrain profile is not the GzTerrainMatGen::SM2Profile we declare locally and the static_cast we previously used produces a pointer that points nowhere. Subsequent setReceiveDynamicShadowsLightTypes / setReceiveDynamicShadowsPSSM calls then write through that bogus pointer and corrupt the heap. Use dynamic_cast and skip the SM2 profile setters when the cast fails; this keeps the legacy 1.9 path working (where GzTerrainMatGen IS the active profile) and silently does nothing on >= 1.11 paths. Generated-by: Claude Sonnet 4.6 Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
Contributor
Author
|
Failure could be #1280 |
iche033
reviewed
Apr 30, 2026
Contributor
iche033
left a comment
There was a problem hiding this comment.
changes look safe and compatible with ogre 1.9
iche033
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎉 New feature
Part of #1281. Preparation for an ogre-1.12 migration.
Summary
Commits are self-explanatory. The PR contains many fixes for preparing the code base to be migrated to ogre 1.12.
Forward-compatible API renames, wrapped in version guards so the tree still builds on OGRE 1.9 and 1.12. No packages.apt change. New OGRE_VERSION_LT_1_10_0 / _LT_1_11_0 / _LT_1_12_0 / _LT_1_12_9 macros are added in ogre/src/CMakeLists.txt; an internal OgreCompat.hh shim provides Ogre::HBU_GPU_ONLY / HBU_CPU_TO_GPU aliases when building against pre-1.12.9 OGRE.
Renames covered: <OgreVector3.h> → <OgreVector.h>, ST_GENERIC → "DefaultSceneManager", HBU_*_WRITE_ONLY → Ogre::HBU_GPU_ONLY / HBU_CPU_TO_GPU, getBoneIterator() → range-for over getBones(), RGN_DEFAULT group on MaterialManager::getByName, internal OgreGLFBORenderTexture.h removed; defensive dynamic_cast + null-guard in OgreHeightmap::SetupShadows; SetNormalMap extracted into a shared CreateOgreTextureFromImage helper.
Checklist
codecheckpassed (See contributing)Generated-by: Claude Sonnet 4.6
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.