I found this: http://discourse.urho3d.io/t/solved-how-to-create-mesh/35/1 I got it working! The only thing is that light doesn’t seem to work… I am sure it is something simple. Any thoughts?
Here is the modified code from the post linked above for those who want to see.
[code] float dirLightVertexData[] =
{
-1, 1, 0, 0, 0,
1, 1, 0, 0.5f, 0,
1, -1, 0, 0.5f, 0.5f,
-1, -1, 0, 0, 0.5f,
};
unsigned short dirLightIndexData[] =
{
0, 1, 2,
2, 3, 0,
};
SharedPtr<VertexBuffer> dlvb(new VertexBuffer(context_));
dlvb->SetShadowed(true);
dlvb->SetSize(4, MASK_POSITION | MASK_TEXCOORD1);
dlvb->SetData(dirLightVertexData);
SharedPtr<IndexBuffer> dlib(new IndexBuffer(context_));
dlib->SetShadowed(true);
dlib->SetSize(6, false);
dlib->SetData(dirLightIndexData);
Geometry *dirLightGeometry_ = new Geometry(context_);
dirLightGeometry_->SetVertexBuffer(0, dlvb);
dirLightGeometry_->SetIndexBuffer(dlib);
dirLightGeometry_->SetDrawRange(TRIANGLE_LIST, 0, dlib->GetIndexCount());
SharedPtr<Model> testModel(new Model(context_));
Vector<SharedPtr<VertexBuffer> > dlvbVector;
Vector<SharedPtr<IndexBuffer> > dlibVector;
dlvbVector.Push(dlvb);
dlibVector.Push(dlib);
testModel->SetNumGeometries(1);
testModel->SetNumGeometryLodLevels(0, 1);
testModel->SetGeometry(0, 0, dirLightGeometry_);
// Define the model buffers and bounding box
PODVector<unsigned> emptyMorphRange;
testModel->SetVertexBuffers(dlvbVector, emptyMorphRange, emptyMorphRange);
testModel->SetIndexBuffers(dlibVector);
//testModel->SetBoundingBox(BoundingBox(Vector3(-1.0f, -1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f)));
Node* testnodea = scene_->CreateChild("testasdasd");
StaticModel* testObjecta = testnodea->CreateComponent<StaticModel>();
testObjecta->SetModel(testModel);
Material* mat = new Material(context_);
mat->SetNumTechniques(1);
mat->SetTechnique(0, cache->GetResource<Technique>("Techniques/Diff.xml") );
Texture* tex = cache->GetResource<Texture2D>("Textures/BlueOre.png");
tex->SetFilterMode(FILTER_NEAREST);
mat->SetTexture(TU_DIFFUSE, tex);
testObjecta->SetMaterial(0,mat);[/code]