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: 18
Joined: Sun Jan 14, 2018 6:12 am

wireframe color

Post by srd » Tue Oct 09, 2018 2:05 am

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?
0 x

gabbsson
Gnoblar
Posts: 20
Joined: Wed Aug 08, 2018 9:03 am
x 3

Re: wireframe color

Post by gabbsson » Tue Oct 09, 2018 3:01 pm

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!
1 x

srd
Gnoblar
Posts: 18
Joined: Sun Jan 14, 2018 6:12 am

Re: wireframe color

Post by srd » Sat Oct 13, 2018 2:48 am

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?
0 x

Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 533
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 11

Re: wireframe color

Post by Slicky » Sat Oct 13, 2018 7:14 am

Isn't the 4th parameter of colour alpha? If so try 1 there instead of 0.
0 x

dermont
Orc Shaman
Posts: 768
Joined: Thu Dec 09, 2004 2:51 am
x 8

Re: wireframe color

Post by dermont » Sat Oct 13, 2018 8:16 am

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

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

Post Reply