CS602 Computer Graphics# 1

download CS602 Computer Graphics# 1

of 3

Transcript of CS602 Computer Graphics# 1

  • 7/31/2019 CS602 Computer Graphics# 1

    1/3

    CS602 Computer Graphics

    Assignment# 1

    Muhammad Sheraz

    Bc080200115

    Question No 1:

    Give name of ten graphic primitives provided by OpenGL library.

    Answer:

    1) GL_POINTS

    2) GL_LINES

    3) GL_LINE_STRIP4) GL_LINE_LOOP

    5) GL_TRIANGLES

    6) GL_TRIANGLE_STRIP7) GL_TRIANGLE_FAN

    8) GL_QUADS

    9) GL_QUAD_STRIP

    10) GL_POLYGON

    Question No 2:

    Illustrate the communication mechanism between CPU (Central Processing Unit) and GPU(Graphics Processing Unit).

    Answer:

    Communication between CPU and GPU

  • 7/31/2019 CS602 Computer Graphics# 1

    2/3

    Question No 3:

    Briefly describe the operations performed before a fragment is written to the image bufferin GPU

    Answer:

    The first fragmented operation performed and the only one that cannot be disabled is the

    pixel ownership test. The pixel owner ship test simply determines whether a fragmentedlies 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 view

    port 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 view port

    called the scissor rectangle to which rendering g should be restricted any fragments fallingoutside 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 theapplication 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.

  • 7/31/2019 CS602 Computer Graphics# 1

    3/3

    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 valuepreviously specified by application. The stencil test passes only if a specific relation is

    satisfied e.g. 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 thestencil 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 theshadow rendering technique.

    The final test undergone by fragment is depth test. The depth test compares the final depthassociated 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 passesthe 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 combiningthe 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 producespecial effects such as transparency.