Triangle-drawing program


You are writing a code for a new graphics card which is software programmable, instead of having the algorithms embedded in the hardware. You wish to write a fast triangle-drawing program to test the card.

Question 1: Give pseudo code, or similar, which draws a triangle with a constant color. Suppose that the inputs are the color of the triangle and three two-dimensional points, representing the three vertices of triangle. Further, suppose that all the three vertices lie on the visible screen and that no anti-aliasing is needed. You might suppose that there is a function to set a pixel, (x; y), to a particular color, c, example: setpixel(x, y, c), however you must give pseudo code for any other functions which you require. Your answer must be adequately detailed that it could be transferred directly into a language like Java however your answer does not, itself, have to be syntactically right.

Question 2: Outline the additional steps needed to draw a triangle specified by three-dimensional points in world space, where the triangle might extend beyond the edges of the screen after the conversion to screen space.

Question 3: Outline the steps needed to compute the triangle's color, supposing diffuse shading, with multiple point lights, however still producing a single color for the entire triangle.

Request for Solution File

Ask an Expert for Answer!!
Computer Graphics: Triangle-drawing program
Reference No:- TGS08934

Expected delivery within 24 Hours