I'm using 2.1 and have no lighting. I saw in another post that to change the color of my wireframe, I should setDiffuse() on an Ogre::HlmsPbsDatablock. I did this, but my wireframe is still black.
Anyone help?
wireframe color
-
- Halfling
- Posts: 65
- Joined: Wed Aug 08, 2018 9:03 am
- x 13
Re: wireframe color
I'm pretty sure it's still black because you don't have lighting. You can either add lighting or switch to HlmsUnlitDatablock.
I'm assuming you already know how to set up the different hlms and datablocks.
For the unlit I remember reading somewhere that you should something like this:
The above works for me (Ogre 2.1).
Hope that helps!
I'm assuming you already know how to set up the different hlms and datablocks.
For the unlit I remember reading somewhere that you should something like this:
Code: Select all
HlmsUnlitDatablock unlitDatablock = ... // "Standard" datablock creation
unlitDatablock.setUseColour(true);
unlitDatablock.setColour(ColourValue(1, 0, 0, 0)); // Red colour
Hope that helps!
-
- Gnoblar
- Posts: 21
- Joined: Sun Jan 14, 2018 6:12 am
Re: wireframe color
Here's how I'm trying to set up HlmsUnlitDatablock.
And here's the error I'm getting ...
And I am calling registgerHlms().
Any ideas?
Code: Select all
Ogre::HlmsManager* hlmsmgr = Ogre::Root::getSingleton().getHlmsManager();
Ogre::HlmsUnlitDatablock *hlmsunlit = static_cast<Ogre::HlmsUnlitDatablock*>
(hlmsmgr->getHlms(Ogre::HLMS_UNLIT));
Ogre::HlmsMacroblock mb = Ogre::HlmsMacroblock();
mb.mPolygonMode = Ogre::PM_WIREFRAME;
mb.mCullMode = Ogre::CULL_NONE;
Ogre::HlmsUnlitDatablock *udb = static_cast<Ogre::HlmsUnlitDatablock*>
(hlmsunlit->createDatablock("MyDatablock", "MyDatablock",
mb, Ogre::HlmsBlendblock(), Ogre::HlmsParamVec()));
udb.setUseColour(true);
udb.setColour(ColorValue(1, 0, 0, 0));
Code: Select all
test_graphics_sys.cpp: In member function ‘virtual void TestGraphicsSystem::createTestScene()’:
test_graphics_sys.cpp:66:44: error: invalid static_cast from type ‘Ogre::Hlms*’ to type ‘Ogre::HlmsUnlitDatablock*’
(hlmsmgr->getHlms(Ogre::HLMS_UNLIT));
And I am calling registgerHlms().
Any ideas?
-
- Bronze Sponsor
- Posts: 614
- Joined: Mon Apr 14, 2003 11:48 pm
- Location: Was LA now France
- x 25
Re: wireframe color
Isn't the 4th parameter of colour alpha? If so try 1 there instead of 0.
-
- Bugbear
- Posts: 812
- Joined: Thu Dec 09, 2004 2:51 am
- x 42
Re: wireframe color
///// Ogre::HlmsUnlitDatablock *hlmsunlit = static_cast<Ogre::HlmsUnlitDatablock*>
///// (hlmsmgr->getHlms(Ogre::HLMS_UNLIT));
Ogre::HlmsUnlit *hlmsunlit = static_cast<Ogre::HlmsUnlit*>
(hlmsmgr->getHlms(Ogre::HLMS_UNLIT));
///// (hlmsmgr->getHlms(Ogre::HLMS_UNLIT));
Ogre::HlmsUnlit *hlmsunlit = static_cast<Ogre::HlmsUnlit*>
(hlmsmgr->getHlms(Ogre::HLMS_UNLIT));