Mushinyi Panashe Assignment 2 Computer Graphics and Visualisation h180534v Software Engineering Department
Mushinyi Panashe Assignment 2 Computer Graphics and Visualisation h180534v Software Engineering Department
assignment 2
computer graphics and visualisation
h180534v
software engineering department
Question one
Explain polygon basics and different types of polygons in Open GL [25]
Answer
GL_LINE_LOOP same as above, with a segment added between last and first vertices
GL_LINE_STRIP Draws a line segment from v0 to v1, then from v1 to v2, and so on,
finally drawing the segment from vn-2 to vn-1. Thus, a total of n-1 line
segments are drawn. Nothing is drawn unless n is larger than 1. There
are no restrictions on the vertices describing a line strip (or a line loop);
the lines can intersect arbitrarily.
GL_TRIANGLES Draws a series of triangles (three-sided polygons) using vertices v0, v1,
v2, then v3, v4, v5, and so on. If n isn't an exact multiple of 3, the final
one or two vertices are ignored.
GL_TRIANGLE_S Draws a series of triangles (three-sided polygons) using vertices v0, v1,
TRIP v2, then v2, v1, v3 (note the order), then v2, v3, v4, and so on. The
ordering is to ensure that the triangles are all drawn with the same
orientation so that the strip can correctly form part of a surface.
Preserving the orientation is important for some operations, such as
culling.n must be at least 3 for anything to be drawn.
GL_TRIANGLE_F Same as GL_TRIANGLE_STRIP, except that the vertices are v0, v1,
AN v2, then v0, v2, v3, then v0, v3, v4, and so on (see Figure 2-7).
GL_POLYGON Draws a polygon using the points v0, ... , vn-1 as vertices. n must be at
least 3, or nothing is drawn. In addition, the polygon specified must not
intersect itself and must be convex. If the vertices don't satisfy these
conditions, the results are unpredictable.
Question two
1. Explain RGB colour mode and index colour mode. [15]
Answer
RGB color
Based on tristimulus theory of vision our eye perceives color through stimulate one of three
visual pigments in the cones of the retina.
These visual pigments have peak sensitivity at red, green and blue color.
So combining these three colors we can obtain wide range of color this concept is used in
RGB color model.As shown in figure this model is represented as unit cube.
Origin represent black color and vertex (1,1,1) is white.Vertex of the cube on the axis
represents primary color R, G, and B.
In XYZ color model any color intensity is obtained by addition of primary color.
C λ = RR + GG + BB Where R, G, and B is amount of corresponding primary color
Since it is bounded in between unit cube it’s values is very in between 0 to 1 and represented
as triplets
(R,G,B). For example magenta color is represented with (1,0,1).
Shades of gray are represented along the main diagonal of cube from black to white vertex.
For half way gray scale we use triplets (0.5,0.5,0.5).
Each color component is stored separately in the frame buffer
Usually 8 bits per component in buffer
RGB images use three colors, or channels, to reproduce colors on screen. In 8-bits-per-
channel images, the three channels translate to 24 (8 bits x 3 channels) bits of color
information per pixel.
With 24-bit images, the three channels can reproduce up to 16.7 million colors per pixel.
With 48-bit (16-bits-per-channel) and 96-bit (32-bits-per-channel) images, even more colors
can be reproduced per pixel.
Although RGB is a standard color model, the exact range of colors represented can vary,
depending on the application or display device.
Indexed Color