Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:36:20+00:00 2026-06-05T02:36:20+00:00

This is mostly a theoretical question. Let’s say I want to draw a triangle

  • 0

This is mostly a theoretical question.

Let’s say I want to draw a triangle on the screen. If I supply my vertex shader with 3 points in 3d, it will convert them to 3 points in 2d, in window coordinates, or screen coordinates. Basically 3 pixel coordinates on your monitor or display.

How, from here, does the graphics pipeline go about filling in this triangle, based on those three points? My guess is something like this:

  1. Bound the triangle with a box by determining the upper and lower bounds for x and y like so:
    enter image description here

  2. Use Bresenham’s line algorithm to draw the 3 edges of the triangle with 3 different colors. You cannot use the regular color buffer for this step.

  3. Do this for every row of pixels in the box: Start from the leftmost pixel (in whereever you stored the results of step 2), go right until you hit an edge. Now, keep going right, coloring pixels in (running the fragment shader), and writing to the regular color buffer, until you hit a different line (hitting a different colored pixel in whereever the results of step 2 was stored). Then stop and go to the next line.

  4. Draw the edges with the fragment shader in the regular color buffer.

This seems like a complicated and inefficient solution. How is it actually done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:36:22+00:00Added an answer on June 5, 2026 at 2:36 am

    Have a look at the scanline algorithm. It’s basically moving a horizontal line from top to bottom, calculating the two intersections of this scanline with the triangle, then drawing a line between these two points.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more of a theoretical question rather than language specific, but I'm mostly
This is mostly a theoretical question I'm just very curious about. (I'm not trying
This is mostly just out of curiosity, and is potentially a silly question. :)
This is mostly a data warehouse philosophy question. My project involves an Oracle forms
This question is mostly academic. I ask out of curiosity, not because this poses
A Purely theoretical question on Tcl. Following this question I was thinking on what
First of all, this question is purely theoretical. Fact is, whether it's possible or
this is mostly a theoritical question about the best practices. I'm currently programming a
This is a pretty-much theoretical question, but.. How much of an operating system could
This is mostly a philosophy question, as the actual problem is solved. The SDK

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.