c++ - Adding another triangle -
trying de-engineer code received figure out how directx works. have triangle up, , have figured out how (change color, size, position..etc) except adding triangle. have read extensively on directxtutorial.com , think has vertices, awesome good, makes sense, can't work me!
to code below tried add more float2's no luck...
float2 trianglevertices[] = { float2(-0.5f, 0.5f), float2(0.0f, 3.5f), float2(0.5f, -3.5f), float2(-2.5f, 1.5f), float2(2.0f, -3.5f), float2(0.5f, 3.5f), }; and tried (saw on 3d tutorial)
float2 trianglevertices[] = { { float2(-0.5f, 0.5f), float2(0.0f, 3.5f), float2(0.5f, -3.5f),} { float2(0.5f, -3.5f), float2(0.5f, -3.5f), float2(0.5f, -3.5f),`} }; none of worked. appreciated, looking see doing wrong, , how create triangle. i'll post rest of code below:
// create vertex , index buffers define simple triangle. float2 trianglevertices[] = { float2(-0.5f, 0.5f), float2(0.0f, 3.5f), float2(0.5f, -3.5f), }; unsigned short triangleindices[] = { 4, 1, 2, };
you need add both vertex , index, try below code.
float2 trianglevertices[] = { float2(-0.5f, 0.5f), float2(0.0f, 3.5f), float2(0.5f, -3.5f), float2(-2.5f, 1.5f), float2(2.0f, -3.5f), float2(0.5f, 3.5f), }; unsigned short triangleindices[] = { 0, 1, 2, 3, 5, 4 };
Comments
Post a Comment