Page 1 of 1

wireframe color

Posted: Tue Oct 09, 2018 2:05 am
by srd
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?

Re: wireframe color

Posted: Tue Oct 09, 2018 3:01 pm
by gabbsson
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:

Code: Select all

HlmsUnlitDatablock unlitDatablock  = ... // "Standard" datablock creation

unlitDatablock.setUseColour(true);
unlitDatablock.setColour(ColourValue(1, 0, 0, 0)); // Red colour
The above works for me (Ogre 2.1).

Hope that helps!

Re: wireframe color

Posted: Sat Oct 13, 2018 2:48 am
by srd
Here's how I'm trying to set up HlmsUnlitDatablock.

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));
And here's the error I'm getting ...

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?

Re: wireframe color

Posted: Sat Oct 13, 2018 7:14 am
by Slicky
Isn't the 4th parameter of colour alpha? If so try 1 there instead of 0.

Re: wireframe color

Posted: Sat Oct 13, 2018 8:16 am
by dermont
///// Ogre::HlmsUnlitDatablock *hlmsunlit = static_cast<Ogre::HlmsUnlitDatablock*>
///// (hlmsmgr->getHlms(Ogre::HLMS_UNLIT));

Ogre::HlmsUnlit *hlmsunlit = static_cast<Ogre::HlmsUnlit*>
(hlmsmgr->getHlms(Ogre::HLMS_UNLIT));