Skip to main content
deleted 5 characters in body
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

Good day! ImI'm currently trying to create a small 3D-Engine engine using C++, an Arduino UNO as well as a Nokia 5110 display with ana library. Now I have succesfullysuccessfully drawn a cube using triangles, but I want to fill the triangles to add proper lighting. Now myMy method for drawing triangles is the following one:

LCD5110 lcd(8,9,10,12,11);

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 lcd.drawLine(x1, y1, x2, y2);
 lcd.drawLine(x2, y2, x3, y3);
 lcd.drawLine(x3, y3, x1, y1);
}

My library hasn't got a triangle draw or fill method unfortunately. I I have no idea how I could fill a triangle so I hope for help. Thanks

Thanks in advance...

NOTE: Please keep it simple.

NOTE NR.2: I have already asked this question at StackOverflow but I haven't got a good answer so I will try it again.

Good day! Im currently trying to create a small 3D-Engine using C++, an Arduino UNO as well as a Nokia 5110 display with an library. Now I have succesfully drawn a cube using triangles but I want to fill the triangles to add proper lighting. Now my method for drawing triangles is the following one:

LCD5110 lcd(8,9,10,12,11);

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 lcd.drawLine(x1, y1, x2, y2);
 lcd.drawLine(x2, y2, x3, y3);
 lcd.drawLine(x3, y3, x1, y1);
}

My library hasn't got a triangle draw or fill method unfortunately. I have no idea how I could fill a triangle so I hope for help. Thanks in advance...

NOTE: Please keep it simple.

NOTE NR.2: I have already asked this question at StackOverflow but I haven't got a good answer so I will try it again.

Good day! I'm currently trying to create a small 3D engine using C++, an Arduino UNO as well as a Nokia 5110 display with a library. Now I have successfully drawn a cube using triangles, but I want to fill the triangles to add proper lighting. My method for drawing triangles is the following:

LCD5110 lcd(8,9,10,12,11);

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 lcd.drawLine(x1, y1, x2, y2);
 lcd.drawLine(x2, y2, x3, y3);
 lcd.drawLine(x3, y3, x1, y1);
}

My library hasn't got a triangle draw or fill method unfortunately. I have no idea how I could fill a triangle so I hope for help.

Thanks in advance...

NOTE: Please keep it simple.

NOTE NR.2: I have already asked this question at StackOverflow but I haven't got a good answer so I will try it again.

Source Link

How to fill a triangle using the LCD5110 Graph library?

Good day! Im currently trying to create a small 3D-Engine using C++, an Arduino UNO as well as a Nokia 5110 display with an library. Now I have succesfully drawn a cube using triangles but I want to fill the triangles to add proper lighting. Now my method for drawing triangles is the following one:

LCD5110 lcd(8,9,10,12,11);

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 lcd.drawLine(x1, y1, x2, y2);
 lcd.drawLine(x2, y2, x3, y3);
 lcd.drawLine(x3, y3, x1, y1);
}

My library hasn't got a triangle draw or fill method unfortunately. I have no idea how I could fill a triangle so I hope for help. Thanks in advance...

NOTE: Please keep it simple.

NOTE NR.2: I have already asked this question at StackOverflow but I haven't got a good answer so I will try it again.