wireframe color

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
srd
Gnoblar
Posts: 21
Joined: Sun Jan 14, 2018 6:12 am

wireframe color

Post 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?
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 13

Re: wireframe color

Post 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!
srd
Gnoblar
Posts: 21
Joined: Sun Jan 14, 2018 6:12 am

Re: wireframe color

Post 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?
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: wireframe color

Post by Slicky »

Isn't the 4th parameter of colour alpha? If so try 1 there instead of 0.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: wireframe color

Post 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));
Post Reply