0% found this document useful (0 votes)
65 views6 pages

Mushinyi Panashe Assignment 2 Computer Graphics and Visualisation h180534v Software Engineering Department

This document contains the answers to two questions about computer graphics and visualization. [1] It explains polygon basics in OpenGL, including different types of polygons like triangles, quads, and polygon meshes. It also describes properties like convex vs concave polygons and simple vs non-simple polygons. [2] It describes RGB color mode, which represents colors as combinations of red, green, and blue values. It also explains indexed color mode, where colors are represented by indices into a color table to reduce memory usage.

Uploaded by

panashe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views6 pages

Mushinyi Panashe Assignment 2 Computer Graphics and Visualisation h180534v Software Engineering Department

This document contains the answers to two questions about computer graphics and visualization. [1] It explains polygon basics in OpenGL, including different types of polygons like triangles, quads, and polygon meshes. It also describes properties like convex vs concave polygons and simple vs non-simple polygons. [2] It describes RGB color mode, which represents colors as combinations of red, green, and blue values. It also explains indexed color mode, where colors are represented by indices into a color table to reduce memory usage.

Uploaded by

panashe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Mushinyi panashe

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

 Polygon is a representation of the surface. It is primitive which is closed in nature. It is


formed using a collection of lines.
 It is also called as many-sided figure.
 The lines combined to form polygon are called sides or edges. The lines are obtained by
combining two vertices.
 Polygons are normally drawn with the pixels in the inside filled in, but they can also be
drawn as outlines or a set of points.
 Polygons are drawn by shading in all the pixels enclosed within the boundary. However,
the lines can also be drawn as outlined polygons or simply as points at the vertices.
 A filled polygon might be solidly filled or stippled with a certain pattern.
 Polygons are useful for constructing many types of 3D models and are widely used in the
development of 3D content for animated effects in film, interactive video games, and the
internet.
 Polygons are straight-sided shapes (3 or more sides), defined by three-dimensional points
(vertices) and the straight lines that connect them (edges). The interior region of the
polygon is called the face.
 Vertices, edges, and faces are the basic components of polygons. You select and modify
polygons using these basic components.
 When you model with polygons you usually use three-sided polygons called triangles or
four-sided polygons called quadrilaterals (quads).
 An individual polygon is commonly called a face, and is defined as the area bounded by
three or more vertices and their associated edges.
 When many faces are connected together they create a network of faces called a polygon
mesh (also referred to as a polyset or a polygonal object). You create your 3D polygonal
models using polygon meshes. Polygon meshes can be created using a variety of
techniques.
Polygons in OpenGL
GL_POINTS individual points

GL_LINES pairs of vertices interpreted as individual line segments

GL_LINE_STRIP series of connected line segments

GL_LINE_LOOP same as above, with a segment added between last and first vertices

GL_TRIANGLES triples of vertices interpreted as triangles

GL_TRIANGLE_S linked strip of triangles


TRIP

GL_TRIANGLE_F linked fan of triangles


AN

GL_QUADS quadruples of vertices interpreted as four-sided polygons

GL_QUAD_STRIP linked strip of quadrilaterals

GL_POLYGON boundary of a simple, convex polygon

GL_POINTS Draws a point at each of the n vertices.

GL_LINES Draws a series of unconnected line segments. Segments are drawn


between v0 and v1, between v2 and v3, and so on. If n is odd, the last
segment is drawn between vn-3 and vn-2, and vn-1 is ignored.

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_LINE_LOOP Same as GL_LINE_STRIP, except that a final line segment is drawn


from vn-1 to v0, completing a loop.

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_QUADS Draws a series of quadrilaterals (four-sided polygons) using vertices v0,


v1, v2, v3, then v4, v5, v6, v7, and so on. If n isn't a multiple of 4, the
final one, two, or three vertices are ignored.

GL_QUAD_STRIP Draws a series of quadrilaterals (four-sided polygons) beginning with


v0, v1, v3, v2, then v2, v3, v5, v4, then v4, v5, v7, v6, and so on (see
Figure 2-7). n must be at least 4 before anything is drawn. If n is odd,
the final vertex is ignored.

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.

Convex and Concave Polygons



 A polygon is called convex of line joining any two interior points of the polygon lies inside
the polygon.
 A non-convex polygon is said to be concave. A concave polygon has one interior angle
greater than 180°. So that it can be clipped into similar polygons.
 Convex Polygon - For any two points P 1 , P 2 inside the polygon,all points on the line
segment which connects P 1 and P 2 are inside the polygon.
 All points P = uP 1 + (1- (1 -u)P 2 , u in [0,1] are inside the polygon provided that P 1 and P
2 are inside the polygon.
 Concave Polygon - A polygon which is not convex.

Simple and non simple Polygons

 Simple Polygons – Polygons whose edges do not cross.


 Non simple Polygons – Polygons whose edges cross.
 Two different OpenGL implementations may render non simple polygons differently.
OpenGL does not check if polygons are simple.

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

 Colors are indices into tables of RGB values


 Requires less memory indices usually 8 bits
 indexed color is a technique to manage digital images' colors in a limited fashion, in order to
save computer memory and file storage, while speeding up display refresh and file transfers.
It is a form of vector qantitisation scaling.
 When an image is encoded in this way, color information is not directly carried by the image
pixel data, but is stored in a separate piece of data called a palette: an array of color
elements.
 Every element in the array represents a color, indexed by its position within the array. The
individual entries are sometimes known as color registers.
 The image pixels do not contain the full specification of its color, but only its index in the
palette. This technique is sometimes referred as pseudocolor or indirect color, as colors are
addressed indirectly.
 Although its palette of colors is limited, indexed color can reduce file size
yet maintain the visual quality needed for multimedia presentations, web
pages, and the like.
 Limited editing is available in this mode. For extensive editing, one should
convert temporarily to RGB mode.

You might also like