Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)
Feanor16
Halfling
Posts: 46 Joined: Tue Feb 18, 2014 10:49 pm
Post
by Feanor16 » Wed Jan 25, 2017 3:49 pm
Hi,
i'm trying to make a line using ManualObject. but the simple line display several colours:
this is my code:
Code: Select all
Ogre::ManualObject * ManualObject;
ManualObject = Node_->sceneNode()->getCreator()->createManualObject(Ogre::SCENE_DYNAMIC);
ManualObject->begin("DbRed", Ogre::OT_LINE_LIST); //Datablock DbRed works
ManualObject->colour(0,0,0); // tested but doesn't work
ManualObject->setStatic(false);
ManualObject->position(0.0, 0.0, 1.0);
ManualObject->position(0.0, 0.0, -1.0);
ManualObject->line(0,1);
ManualObject->end();
Node_->attachObject(ManualObject);
someone knows what happen?
thank you
Last edited by Feanor16 on Thu Jan 26, 2017 11:41 am, edited 1 time in total.
Feanor16
Halfling
Posts: 46 Joined: Tue Feb 18, 2014 10:49 pm
Post
by Feanor16 » Thu Jan 26, 2017 11:40 am
Problem Solved: the V2 ManualObject doesn't works with a Pbs Datablock. It works perfectly with Unlit Datablock.
Code: Select all
Ogre::HlmsUnlit *hlmsUnlitMaterials = static_cast<Ogre::HlmsUnlit*>(hlmsManager->getHlms(Ogre::HLMS_UNLIT));
Ogre::HlmsUnlitDatablock *UnlitDatablock;
Ogre::String datablockUnlitName = "UnlitColour";
UnlitDatablock = static_cast<Ogre::HlmsUnlitDatablock*>(hlmsUnlitMaterials->createDatablock(
datablockUnlitName,
datablockUnlitName,
Ogre::HlmsMacroblock(),
Ogre::HlmsBlendblock(),
Ogre::HlmsParamVec() ) );
UnlitDatablock->setUseColour(true);
UnlitDatablock->setColour(Ogre::ColourValue(1,0,0));
al2950
OGRE Expert User
Posts: 1227 Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157
Post
by al2950 » Thu Jan 26, 2017 1:34 pm
This was most likely caused because you did not specify any normals or tangents which are required to calculate any lighting.
Also please note Manual Object really should not be used at all, and was added back to 2.1 due to community pressure to help with porting, but is much more limited. However it is highly recommended to generate vertex buffers yourself, it is much easier than it was in 1.x. Check out the samples "CustomRenderable" & "DynamicGeometry"