johnnycable
Hello there, I need some help. I’m trying to draw a simple line with CustomGeometry class using 24_Urho2DSprite example, but I’m failing at it. I removed all other drawing code (that about sprites) and left a black screen. Then I’m adding the following code:
// custom geometry
auto scp = camera->ScreenToWorldPoint(Vector3(0.5f,0.5f,-1));
Node* lineNode = scene_->CreateChild("lineNode");
CustomGeometry* cg = lineNode->CreateComponent<CustomGeometry>();
cg->Clear();
cg->SetNumGeometries(1);
cg->BeginGeometry(0, PrimitiveType::LINE_LIST);
// cg->DefineGeometry(0, PrimitiveType::POINT_LIST, 3, false,false, false, false);
cg->DefineVertex(Vector3(0,0,0));
cg->DefineVertex(Vector3(10,10,0));
cg->DefineColor(Color::WHITE);
//cg->SetMaterial(<#Urho3D::Material *material#>); ??? is there a default material?
cg->Commit();
lineNode->SetPosition(scp);
What am I missing?