Sunday, October 31, 2010

CS602 Assignment Solution

Question 1:

Give ame of ten primitivies provided by  Open GL libraries.

Solution:
·         GL_POINTS
·         GL_LINES
·         GL_LINE_STRIP
·         GL_LINE_LOOP
·          GL_TRIANGLES
·         GL_TRIANGLE_STRIP
·         GL_TRIANGLE_FAN
·         GL_QUADS
·         GL_QUAD_STRIP
·         GL_POLYGON

Question 2:

Illustrate the communication  mechanism between CPU (central processing unit) and GPU (graphic processing unit ).

Solution: 

Communication between CPU and GPU


 

Question 3:

Briefly describe the operation  performed before a fragment is written to the image buffer in GPU.

Solution:

The first fragmented operation perfumed and the only one that cannot be disabled is the pixel ownership test. The pixel owner ship test simply determines whether a fragmented lies in the region of the view port that is currently visible on the display. a possible reason that the pixel  ownership test fails is that another window is obscuring a portion of the viewport in this case fragments falling behind the obscuring  window are not drawn.


Next the scissor testis performed and application may specify a rectangle in the viewport called the scissor rectangle to which rendering g should be restricted any fragments falling  outside the scissor  rectangle are discarded a particular application of the scissor rectangle in the context of the stencil shadow algorithm is  in section

If the scissor test passed a fragment  undergoes the alpha test when fin al color of the a fragment is calculated and application   may also calculate an alpha value  that usually represents the degree of transparency associated with the fragment  the alpha test compares the final alpha value of the fragment to a constant value that is preset by the application the application specifies what relationship between the two values such as (less then greater than or equal to) causes the test to pass if the relationship is not satisfied then the fragment is discarded.

After alpha test passes a fragment moves on to the stencil test the stencil test reads the value stored in thee stencil buffer at a fragments location and compares it to a value previously specified by application. The stencil test passes only if a specific relation is satisfied eg the stencil value is equal to particular value  otherwise the stencil test fails, and the fragment is discarded and application is able to specify action to be taken in the stencil buffer when the stencil test passes or fail. Additionally if the stencil test passes the value in the stencil buffer may be affected in the way that depends on the result of the depth test (describe next) for instance an application may choose to increment the value in the stencil test passed and depth test fails. This functionality is used extensively by the shadow rendering technique.

The final test undergone by fragment is depth test. The depth test compares the final depth associated with a fragment to the value currently residing in the depth buffer. If the depth does not satisfy an application specified relationship with the value in the depth buffer then the fragment is discarded. Normally, the depth test is configured so that a fragment passes the depth the depth test only its depth is less than or equal to the value in the depth buffer. When the depth test passed the depth buffer is updated with the depth of the fragment to facilitate hidden surface removal for subsequently rendered primitives.

One pixel ownership test alpha test stencil test and depth test have all passed a fragment final color is blended on to the image buffer. The test have passed a fragments final color is blended in to the image buffer the blending operation calculates a new color by combining the fragments final and the color already stored in the image buffer at the fragments location.

The fragments alpha value and alpha value stored in the image buffer may also be used to determine the color that ultimately appears in the view port the blending operation may be configured to simply replace the previous color in the image buffer or it may produce special effects such as transparency.

0 comments:

Post a Comment