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++)
                     // Get the X,Y points of this face 
                     (int)face.GetPointAtIndex(j + 1).points[0],
                     (int)face.GetPointAtIndex(j + 1).points[1]);
                // Draw from first point back to last line
  • \$\begingroup\$ Is Face imported from Solidworks? \$\endgroup\$
    – Jon
    Commented Apr 10, 2015 at 5:49
  • \$\begingroup\$ No, it's all written by myself - Face is simply an array of vectors with some code to perform transformations. \$\endgroup\$
    – Alesso
    Commented Apr 10, 2015 at 13:22
  • \$\begingroup\$ Comment the code you've posted and try drawing a line with explicit coordinates (0,0) and (100,100). Does it appear on screen? \$\endgroup\$
    – Jon
    Commented Apr 10, 2015 at 20:20

1 Answer 1


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.

  • \$\begingroup\$ Do I need the second draw block? Or just the first? \$\endgroup\$
    – Alesso
    Commented Apr 9, 2015 at 22:30
  • \$\begingroup\$ @Alesso Your loop draws the first three (which should be the first two). Your draw call outside the loop draws the last one. \$\endgroup\$ Commented Apr 9, 2015 at 22:32
  • \$\begingroup\$ I see - so I only draw 0->1, 1->2 then 2->0 outside of the loop? \$\endgroup\$
    – Alesso
    Commented Apr 9, 2015 at 22:33
  • \$\begingroup\$ 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? \$\endgroup\$
    – Alesso
    Commented Apr 9, 2015 at 22:37
  • \$\begingroup\$ @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. \$\endgroup\$ Commented Apr 10, 2015 at 0:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .