So I have used the code of this website for drawing filled triangles. But I would like to improve my game by adding the illusion of color. Well sadly I made my game for the monochrome Nokia 5110 screen which can't draw just one pixel but needs to draw lines. So I though about a concept like that: I could enter a float into my fill triangle function (0-1 = 0-100%) and if I for example enter 0.5 then it will only draw 50% of all the pixels. This would be possible by always leaving a small gap when drawing lines. (I don't care if it starts glitching at for example 1 - 10 percent)

So it turns out that I am just way to dumb to create such an complicated filling method. Is this even possible? Thanks in advance!

Epilogue : You don't really need to create this whole function. Just a little tip or link to an already existing method will help. But thanks if you decide to create it anyway :3

  • \$\begingroup\$ Can you include the code you're currently using to fill your triangle? It's often easier to modify existing code than invent it from scratch. \$\endgroup\$
    – DMGregory
    May 18, 2020 at 15:59
  • \$\begingroup\$ Well I have used the code of this site: sunshine2k.de/coding/java/TriangleRasterization/… Sorry if it was unclear! \$\endgroup\$
    – Leocat
    May 19, 2020 at 11:49
  • \$\begingroup\$ I don't want to see the code you referenced, I want to see the code you wrote. Your question is tagged c++, not Java, so presumably you've had to do some translation from the reference. Show us your translation. \$\endgroup\$
    – DMGregory
    May 19, 2020 at 11:51


You must log in to answer this question.

Browse other questions tagged .