Graphics, drawing triangles

I'm very new to the world of Computer Graphics, and I'm struggling to find resources to help me understand how to draw my mesh (I have loaded everything into vertex and index buffers), I am not using a 3D API, instead I am just using C# and a 2D Graphics canvas to draw my mesh.

Everything is currently loading, but I have suspicions that I am reading my faces in as quads instead of triangles, could somebody A) Clarify whether I am draw a quad instead of a triangle B) If I am drawing quads, how do I draw a triangle? This has been a headache for me for a few hours...

for (int i = 0; i < m_numFaces; i++)
{
Face face = m_meshData[i];

// Draw the face
for (int j = 0; j < 3; j++)
{
m_graphicsContext.DrawLine(m_pen,
// Get the X,Y points of this face
(int)face.GetPointAtIndex(j).points[0],
(int)face.GetPointAtIndex(j).points[1],
(int)face.GetPointAtIndex(j + 1).points[0],
(int)face.GetPointAtIndex(j + 1).points[1]);
}
// Draw from first point back to last line
m_graphicsContext.DrawLine(m_pen,
(int)face.GetPointAtIndex(2).points[0],
(int)face.GetPointAtIndex(2).points[1],
(int)face.GetPointAtIndex(0).points[0],
(int)face.GetPointAtIndex(0).points[1]);
}

• Is Face imported from Solidworks?
– Jon
Commented Apr 10, 2015 at 5:49
• No, it's all written by myself - Face is simply an array of vectors with some code to perform transformations. Commented Apr 10, 2015 at 13:22
• Comment the code you've posted and try drawing a line with explicit coordinates (0,0) and (100,100). Does it appear on screen?
– Jon
Commented Apr 10, 2015 at 20:20

You're currently drawing the following lines:

• From point 0 to point 1.
• From point 1 to point 2.
• From point 2 to point 3 (wrong!).
• From point 2 to point 0.

j < 3 should be j < 2.

• Do I need the second draw block? Or just the first? Commented Apr 9, 2015 at 22:30
• @Alesso Your loop draws the first three (which should be the first two). Your draw call outside the loop draws the last one. Commented Apr 9, 2015 at 22:32
• I see - so I only draw 0->1, 1->2 then 2->0 outside of the loop? Commented Apr 9, 2015 at 22:33
• I updated my code to be j < 2 the mesh that has been drawn still looks the same as it did before. Why is this? Commented Apr 9, 2015 at 22:37
• @Alesso Then maybe the problem you're seeing isn't the one I told you about; without more information I can't really help you. Commented Apr 10, 2015 at 0:22