Draw three color lines

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Rikenbacker
Gnoblar
Posts: 7
Joined: Wed Nov 13, 2013 5:45 pm

Draw three color lines

Post by Rikenbacker » Thu Aug 03, 2017 2:09 pm

Please help me with drawing color lines.
I think I doing right when coding lines like that:

Code: Select all

	Ogre::SceneNode *sceneNode = m_graphicSystem->getSceneManager()->getRootSceneNode(Ogre::SCENE_DYNAMIC)->createChildSceneNode(Ogre::SCENE_DYNAMIC);

	manualObject->begin("Ogre/Skin", Ogre::OT_LINE_LIST);
	manualObject->position(0, 0, 0);
	manualObject->position(100, 0, 100);
	manualObject->line(0, 1);
	manualObject->end();
	sceneNode->attachObject(manualObject);
It is drawing line, but "Ogre/Skin" is obviously wrong, because line drawing with background color.
I can't understeand how doing a dynamic material for lines. Please help me to draw green, red and black lines.
0 x

Rikenbacker
Gnoblar
Posts: 7
Joined: Wed Nov 13, 2013 5:45 pm

Re: Draw three color lines

Post by Rikenbacker » Thu Aug 03, 2017 2:43 pm

I using Ogre 2.1
0 x

Rikenbacker
Gnoblar
Posts: 7
Joined: Wed Nov 13, 2013 5:45 pm

Re: Draw three color lines

Post by Rikenbacker » Fri Aug 04, 2017 3:42 pm

I trying do by manual

Code: Select all

	manualObject = m_graphicSystem->getSceneManager()->createManualObject();
	manualObject->begin("BaseWhiteNoLighting", Ogre::OT_TRIANGLE_LIST);
	
	float cp = 1.0f * 10.0f;
	float cm = -1.0f * 10.0f;

	manualObject->position(cm, cp, cm);// a vertex
	manualObject->colour(Ogre::ColourValue(0.0f, 1.0f, 0.0f, 1.0f));
	manualObject->position(cp, cp, cm);// a vertex
	manualObject->colour(Ogre::ColourValue(1.0f, 1.0f, 0.0f, 1.0f));
	manualObject->position(cp, cm, cm);// a vertex
	manualObject->colour(Ogre::ColourValue(1.0f, 0.0f, 0.0f, 1.0f));
	manualObject->position(cm, cm, cm);// a vertex
	manualObject->colour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));

	manualObject->position(cm, cp, cp);// a vertex
	manualObject->colour(Ogre::ColourValue(0.0f, 1.0f, 1.0f, 1.0f));
	manualObject->position(cp, cp, cp);// a vertex
	manualObject->colour(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 1.0f));
	manualObject->position(cp, cm, cp);// a vertex
	manualObject->colour(Ogre::ColourValue(1.0f, 0.0f, 1.0f, 1.0f));
	manualObject->position(cm, cm, cp);// a vertex
	manualObject->colour(Ogre::ColourValue(0.0f, 0.0f, 1.0f, 1.0f));

	// face behind / front
	manualObject->triangle(0, 1, 2);
	manualObject->triangle(2, 3, 0);
	manualObject->triangle(4, 6, 5);
	manualObject->triangle(6, 4, 7);

	// face top / down
	manualObject->triangle(0, 4, 5);
	manualObject->triangle(5, 1, 0);
	manualObject->triangle(2, 6, 7);
	manualObject->triangle(7, 3, 2);

	// face left / right
	manualObject->triangle(0, 7, 4);
	manualObject->triangle(7, 0, 3);
	manualObject->triangle(1, 5, 6);
	manualObject->triangle(6, 2, 1);
	manualObject->end();
	sceneNode->attachObject(manualObject);
	manualObject->setVisible(true);
But Cube showing without color. What i doing wrong?
Attachments
Безымянный.png
0 x

Post Reply