CG Lab Manual 2022-2023
CG Lab Manual 2022-2023
CG Lab Manual 2022-2023
INSTITUTE To impart value added technological education through pursuit of academic excellence,
VISION research and entrepreneurial attitude.
M1: To achieve academic excellence through innovative teaching and learning process.
INSTITUTE
MISSION M2: To imbibe the research culture for addressing industry and societal needs.
M4: To produce competent and socially responsible professionals with core human values.
M4: To incorporate social and ethical awareness among the students to make them
conscientious professionals.
Department
Program Educational Objectives (PEOs)
PEO1: To Impart fundamentals in science, mathematics and engineering to cater the needs of society
and Industries.
PEO2: Encourage graduates to involve in research, higher studies, and/or to become entrepreneurs.
PEO3: To Work effectively as individuals and as team members in a multidisciplinary environment with
high ethical values for the benefit of society.
PR: 25 Marks
Course Objectives:
CO1: Identify the basic terminologies of Computer Graphics and interpret the mathematical foundation
of the concepts of computer graphics.
CO2: Apply mathematics to develop Computer programs for elementary graphic operations.
CO3: Illustrate the concepts of windowing and clipping and apply various algorithms to fill and clip polygons.
CO4: Understand and apply the core concepts of computer graphics, including transformation in two
and three dimensions, viewing and projection.
CO5: Understand the concepts of color models, lighting, shading models and hidden surface
elimination.
CO6: Create effective programs using concepts of curves, fractals, animation and gaming.
Course Outcomes:
On completion of the course, student will be able to-
CO1: Understand and apply the concepts like inheritance, polymorphism, exception handling and
generic structures for implementing reusable programming codes.
CO2: Analyze the concept of file and apply it while storing and retrieving the data from secondary
storages.
CO3: Analyze and apply computer graphics algorithms for line-circle drawing, scan conversion and
filling with the help of object oriented programming concepts.
CO4: Understand the concept of windowing and clipping and apply various algorithms to fill and clip
polygons.
CO5: Apply logic to implement, curves, fractals, animation and gaming programs.
List of Assignments
Sr. TITLE
No. Group A
01 Write C++ program to draw a concave polygon and fill it with desired color using scan fill algorithm.Apply the
concept of inheritance.
Write C++ program to implement Cohen Southerland line clipping algorithm.
02
Write C++ program to draw the following pattern. Use DDA Line and Bresenham‘s Circle drawing algorithm.
03 Apply Concept of encapsulation.
Group B
04 Write C++ program to draw 2-D object and perform following basic transformations, Scaling b) Translation c)
Rotation. Apply concept of operator overloading.
05 Write C++ program to generate Hilbert curve using concept of fractals.
Group C
06 Write OpenGL program to draw Sun Rise and Sunset.
07 Write a C++ program to implement bouncing ball using sine wave form. Apply the concept of
polymorphism.
Mini-Projects / Case Study
08 Design and implement game / animation clip / Graphics Editor using open source graphics library. Make use of
maximum features of Object Oriented Programming.
Problem Statement: Write C++ program to draw a concave polygon and fill it with desired color using scan fill
algorithm. Apply the concept of inheritance.
Objective: To understand Scan Fill Algorithms
Outcome: Implement Scan Fill Algorithm
Theory Concepts:
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.
Example of Polygon:
1. Triangle
2. Rectangle
3. Hexagon
4. Pentagon
Following figures shows some polygons.
Types of Polygons:
1. Concave
2. Convex.
3. Complex.
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.
A convex polygon is a simple polygon whose interior is a convex set. In a convex polygon, all interior angles
are less than 180 degrees.
The following properties of a simple polygon are all equivalent to convexity:
Every internal angle is less than or equal to 180 degrees.
Every line segment between two vertices remains inside or on the boundary of the polygon.
A concave polygon will always have an interior angle greater than 180 degrees. It is possible to cut a
concave polygon into a set of convex polygons. You can draw at least one straight line through a concave polygon
that crosses more than two sides.
Complex polygon is a polygon whose sides cross over each other one or more times.
Polygon Filling:
For filling polygons with particular colors, you need to determine the pixels falling on the border of the
polygon and those which fall inside the polygon.
It is an image space algorithm. It processes one line at a time rather than one pixel at a time. It uses the
concept area of coherence. This algorithm records edge list, active edge list. So accurate bookkeeping is
necessary. The edge list or edge table contains the coordinate of two endpoints. Active Edge List (AEL) contain
edges a given scan line intersects during its sweep. The active edge list (AEL) should be sorted in increasing order
of x. The AEL is dynamic, growing and shrinking.
Algorithm:
Step 1: Start algorithm
Step 2: Initialize the desired data structure
a) Create a polygon table having color, edge pointers, coefficients
b) Establish edge table contains information regarding, the end point of edges, pointer to polygon, inverse
slope.
c) Create Active edge list. This will be sorted in increasing order of x.
d) Create a flag F. It will have two values either on or off.
Step 3: Perform the following steps for all scan lines
a) Enter values in Active edge list (AEL) in sorted order using y as value
b) Scan until the flag, i.e. F is on using a background color
c) When one polygon flag is on, and this is for surface S1enter color intensity as I1 into refresh buffer
d) When two or image surface flag are on, sort the surfaces according to depth and use intensity value Sn for
the nth surface. This surface will have least z depth value
e) Use the concept of coherence for remaining planes.
Step 4: Stop Algorithm
Conclusion:
After completion of experiment students are able to implement Scan Fill Algorithm.
Questions:
1. Which are the different approaches to fill a polygon?
2. What are advantages and drawbacks of scan line polygon fill algorithm?
Problem Statement: Write C++ program to implement Cohen Southerland line clipping algorithm
Objective:
To understand Cohen Sutherland Line Clipping Algorithm.
Outcome:
Implement Cohen Sutherland Line Clipping Algorithm.
Theory Concepts:
Line Clipping:
It is performed by using the line clipping algorithm. The line clipping algorithms are:
1. Cohen Sutherland Line Clipping Algorithm
2. Midpoint Subdivision Line Clipping Algorithm
3. Liang-Barsky Line Clipping Algorithm
Cohen Sutherland Line Clipping Algorithm:
In the algorithm, first of all, it is detected whether line lies inside the screen or it is outside the screen. All
lines come under any one of the following categories:
1. Visible
2. Not Visible
3. Clipping Case
1. Visible: If a line lies within the window, i.e., both endpoints of the line lies within the window. A line is
visible and will be displayed as it is.
2. Not Visible: If a line lies outside the window it will be invisible and rejected. Such lines will not display. If
any one of the following inequalities is satisfied, then the line is considered invisible. Let A (x1,y2) and B
(x2,y2) are xmin,xmax are coordinates of the window.
endpoints of line.
3. Clipping Case: If the line is neither visible case nor invisible case. It is considered to be clipped case. First of all, the
category of a line is found based on nine regions given below. All nine regions are assigned codes. Each code is of 4 bits.
If both endpoints of the line have end bits zero, then the line is considered to be visible.
The center area is having the code, 0000, i.e., region 5 is considered a rectangle window.
1. It calculates end-points very quickly and rejects and accepts lines quickly.
2. It can clip pictures much large than screen size.
Step4:If a line is clipped case, find an intersection with boundaries of the window
m=(y2-y1 )(x2-x1)
(a) If bit 1 is "1" line intersects with left boundary of rectangle window
y3=y1+m(x-X1)
where X = Xwmin
where Xwminis the minimum value of X co-ordinate of window
Let R be the rectangular window whose lower left-hand corner is at L (-3, 1) and upper right-hand corner is at R
(2, 6). Find the region codes for the endpoints in fig:
The region code for point (x, y) is set according to the scheme
Bit 1 = sign (y-ymax) =sign (y-6) Bit 3 = sign (x-xmax)= sign (x-2)
Bit 2 = sign (ymin-y)=sign(1-y) Bit 4 = sign (xmin-x)=sign(-3-x)
Here
So
We place the line segments in their appropriate categories by testing the region codes found in the problem.
Category1 (visible): EF since the region code for both endpoints is 0000.
Category2 (not visible): IJ since (1001) AND (1000) =1000 (which is not 0000).
Category 3 (candidate for clipping): AB since (0001) AND (1000) = 0000, CD since (0000) AND (1010) =0000, and
GH. Since (0100) AND (0010) =0000.
In clipping AB, the code for A is 0001. To push the 1 to 0, we clip against the boundary line xmin=-3. The
resulting intersection point is I1 (-3,3 ). We clip (do not display) AI1 and I1 B. The code for I1is 1001. The clipping
category for I1 B is 3 since (0000) AND (1000) is (0000). Now B is outside the window (i.e., its code is 1000), so we
push the 1 to a 0 by clipping against the line ymax=6. The resulting intersection is l2 (-1 ,6). Thus I2 B is clipped. The
code for I2 is 0000. The remaining segment I1 I2 is displayed since both endpoints lie in the window (i.e., their codes are
0000).
For clipping CD, we start with D since it is outside the window. Its code is 1010. We push the first 1 to a 0 by
clipping against the line ymax=6. The resulting intersection I3 is ( ,6),and its code is 0000. Thus I3 D is clipped and the
remaining segment CI3 has both endpoints coded 0000 and so it is displayed.
For clipping GH, we can start with either G or H since both are outside the window. The code for G is 0100, and
we push the 1 to a 0 by clipping against the line ymin=1.The resulting intersection point is I4 (2 ,1) and its code is 0010.
We clip GI4 and work on I4 H. Segment I4 H is not displaying since (0010) AND (0010) =0010.
Conclusion:
Upon completion Students will be able to implement Cohen Sutherland Line Clipping Algorithm.
Questions:
Problem Statement:
Write C++ program to draw the following pattern. Use DDA line and Bresenham‘s circle drawing
algorithm. Apply the concept of encapsulation
Objective:
To understand and implement DDA line and Bresenham’s circle drawing algorithm.
Outcome:
Implement computer graphics programs in C++ using line and circle algorithm.
Theory Concepts:
Graphics:
Graphics are defined as any sketch or a drawing or a special network that pictorially represents some
meaningful information. Computer Graphics is used where a set of images needs to be manipulated or the
creation of the image in the form of pixels and is drawn on the computer.
Let us assume we have two points of the line (x1, y1) and (x2, y2). Now, we will put values of the two
points in straight line equation, and we get
y = mx + c
y2 = mx2+c ... (1)
Example:
A line has a starting point (1,7) and ending point (11,17). Apply the Digital Differential Analyzer
algorithm to plot a line.
Solution: We have two coordinates,
Starting Point = (x1, y1) = (1,7)
Ending Point = (x2, y2) = (11,17)
Step 1: First, we calculate Δx, Δy and m.
Δx = x2 – x1 = 11-1 = 10
Δy = y2 – y1 = 17-7 = 10
m = Δy/Δx = 10/10 = 1
Step 2: Now, we calculate the number of steps.
Δx = Δy = 10
Then, the number of steps = 10
Step 3: We get m = 1, Third case is satisfied.
Now move to next step.
Department of Computer Engineering , ZCOER, Narhe, Pune-41 Page 15
Computer Graphics Laboratory (210248) Class: SE (Computer)
Step 4: We will repeat step 3 until we get the endpoints of the line.
Step 5: Stop
Advantages:
It is a simple algorithm to implement.
It is a faster algorithm than the direct line equation.
We cannot use the multiplication method in Digital Differential Analyzer.
Digital Differential Analyzer algorithm tells us about the overflow of the point when the point changes
its location.
Disadvantages:
The floating-point arithmetic implementation of the Digital Differential Analyzer is time-consuming.
The method of round-off is also time-consuming.
Sometimes the point position is not accurate
Example:
Plot 6 points of circle using Bresenham Algorithm. When radius of circle is 10 units. The circle has
centre (50, 50).
Solution: Let r = 10 (Given)
Step1: Take initial point (0, 10)
d = 3 - 2r
d = 3 - 2 * 10 = -17
d<0
∴ d = d + 4x + 6
= -17 + 4 (0) + 6
= -11
Step2: Plot (1, 10)
d = d + 4x + 6 (∵ d < 0)
= -11 + 4 (1) + 6
= -1
Step3: Plot (2, 10)
d = d + 4x + 6 (∵ d < 0)
= -1 + 4 x 2 + 6
= 13
Step4: Plot (3, 9) d is > 0 so x = x + 1, y = y - 1
d = d + 4 (x-y) + 10 (∵ d > 0)
= 13 + 4 (3-9) + 10
= 13 + 4 (-6) + 10
= 23-24=-1
Step5: Plot (4, 9)
d = -1 + 4x + 6
= -1 + 4 (4) + 6
= 21
Step6: Plot (5, 8)
d = d + 4 (x-y) + 10 (∵ d > 0)
= 21 + 4 (5-8) + 10
= 21-12 + 10 = 19
So P1 (0,0)⟹(50,50)
P2 (1,10)⟹(51,60)
P3 (2,10)⟹(52,60)
P4 (3,9)⟹(53,59)
P5 (4,9)⟹(54,59)
P6 (5,8)⟹(55,58)
Conclusion:
Upon completion Students will be able to understand concept of DDA line & Bresenham’s circle drawing
algorithm
.
Questions:
1. Explain the derivation of decision parameters in Bresenham’s circle drawing algorithm.
2. Explain the concept of encapsulation with example.
Problem Statement: Write C++ program to draw 2-D object and perform following basic transformations, a)Scaling
b) Translation c) Rotation. Use operator overloading.
Objective: To understand 2-D object drawing with basic transformations.
Outcome:
Implement basic transformations Scaling, Translation and Rotation to draw 2-D object using Operator
Overloading.
Theory Concepts:
Transformation means changing some graphics into something else by applying rules. We can have
various types of transformations such as translation, scaling up or down, rotation, shearing, reflection etc.
When a transformation takes place on a 2D plane, it is called 2D transformation. Transformations play an
important role in computer graphics to reposition the graphics on the screen and change their size or orientation.
Translation, Scaling and Rotation are basic transformations.
1. Translation:
A translation moves an object to a different position on the screen. You can translate a point in 2D by
adding translation coordinate or translation vector (Tx, Ty) to the original coordinates. Consider
- Initial coordinates of the object O = (Xold, Yold)
- New coordinates of the object O after translation = (Xnew, Ynew)
- Translation vector or Shift vector = (Tx, Ty)
This translation is achieved by adding the translation coordinates to the old coordinates of the object as-
2. Rotation:
In rotation, we rotate the object at particular angle θ (theta) from its original position. Consider
- Initial coordinates of the object O = (Xold, Yold)
- Initial angle of the object O with respect to origin = Φ
- Rotation angle = θ
- New coordinates of the object O after rotation = (Xnew, Ynew)
3. Scaling:
Scaling transformation is used to change the size of an object. In the scaling process, you either expand or
compress the dimensions of the object. Scaling can be achieved by multiplying the original coordinates of
the object with the scaling factor (Sx, Sy). If scaling factor > 1, then the object size is increased. If scaling
factor < 1, then the object size is reduced. Consider
- Initial coordinates of the object O = (Xold, Yold)
- Scaling factor for X-axis = Sx
- Scaling factor for Y-axis = Sy
- New coordinates of the object O after scaling = (Xnew, Ynew)
Homogeneous Coordinates:
Matrix multiplication is easier to implement in hardware and software as compared to matrix addition.
Hence we want to replace matrix addition by multiplication while performing transformation operations.
So the solution is homogeneous coordinates , which allows us to express all transformations (including
translation) as matrix multiplications.
To obtain homogeneous coordinates we have to represent transformation matrices in 3x3 matrices instead of
2x2. For this we add dummy coordinate. Each 2 dimensional position (x,y) can be represented by
homogeneous coordinate as (x,y,1).
Consider that coordinates of vertices of equilateral triangle are (X1,Y1), (X2,Y2) and (X3,Y3). After
applying basic transformations, we will get corresponding coordinates as (X1’,Y1’), (X2’,Y2’) and
(X3’,Y3’) respectively. Following multiplication will give the translation on this equilateral triangle:
Consider that coordinates of vertices of rhombus are (X1,Y1), (X2,Y2), (X3,Y3) and (X4,Y4) applying basic
transformations, we will get corresponding coordinates as (X1’,Y1’), (X2’,Y2’), (X3’,Y3’) and (X4’,Y4’)
respectively. Following multiplication will give the translation on this rhombus:
Conclusion:
After completion of this experiment students will be able to use basic transformations like translation, scaling, rotation in
2D objects.
Questions:
1. How to rotate any 2-D object about an arbitrary point? Explain in brief.
2. Explain the concept of operator overloading with example.
Problem Statement: Write C++ program to generate Hilbert curve using concept of fractals .
Objective: To understand Hilbert Curve using Fractals.
Outcome:
Implement Hilbert Curve using concept of Fractals and Constructor.
Theory Concept:
A first order Hilbert curve is just a single cup (see the figure on the left). It fills a 2×2 space. The second order
Hilbert curve replaces that cup by four (smaller) cups, which are linked together by three joins (see the figure on
the right; the link between a cup and a join has been marked with a fat dot in the figure). Every next order repeats
the process or replacing each cup by four smaller cups and three joins.
The function presented below (in the "C" language) computes the Hilbert curve. Note that the curve is
symmetrical around the vertical axis. It would therefore be sufficient to draw half of the Hilbert curve.
Conclusion:
After completion of this experiment students will be able to use Hilbert Curve using the concept of
Fractals.
Questions:
1. What is the importance of curves and fractals in computer graphics?
2. What are applications of curves and fractals?
Problem Statement: Write OpenGL program to draw Sun Rise and Sunset.
Objective: To understand OpenGL concepts implement to draw Sun Rise and Sunset.
Outcome:
Implement OpenGL concept.
Theory Concept:
OpenGL Basics:
Open Graphics Library (OpenGL) is a cross-language (language independent), cross-platform (platform
independent) API for rendering 2D and 3D Vector Graphics (use of polygons to represent image). OpenGL
is a low-level, widely supported modeling and rendering software package, available across all platforms.
It can be used in a range of graphics applications, such as games, CAD design, or modeling. OpenGL API
is designed mostly in hardware.
Design: This API is defined as a set of functions which may be called by the client program.
Although functions are similar to those of C language but it is language independent.
Development: It is an evolving API and Khronos Group regularly releases its new version having
some extended feature compare to previous one. GPU vendors may also provide some additional
functionality in the form of extension.
Associated Libraries: The earliest version is released with a companion library called OpenGL
utility library. But since OpenGL is quite a complex process. So in order to make it easier other library such
as OpenGL Utility Toolkit is added which is later superseded by freeglut. Later included library were GLEE,
GLEW and glbinding.
2.OpenGL Utility Library (GLU): built on-top of the core OpenGL to provide important utilities
and more building models (such as qradric surfaces). GLU functions start with a prefix "glu"
(e.g., gluLookAt, gluPerspective)
3.OpenGL Utilities Toolkit (GLUT): provides support to interact with the Operating System (such as
creating a window, handling key and mouse inputs); and more building models (such as sphere and torus).
GLUT functions start with a prefix of "glut" (e.g., glutCreatewindow, glutMouseFunc).
GLUT is designed for constructing small to medium sized OpenGL programs. While GLUT is well-suited to
learning OpenGL and developing simple OpenGL applications, GLUT is not a full-featured toolkit so large
Department of Computer Engineering , ZCOER, Narhe, Pune-41 Page 27
Computer Graphics Laboratory (210248) Class: SE (Computer)
applications requiring sophisticated user interfaces are better off using native window system toolkits. GLUT is
simple, easy, and small.
Alternative of GLUT includes SDL.
4. OpenGL Extension Wrangler Library (GLEW): "GLEW is a cross-platform open-source
C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which
OpenGL extensions are supported on the target platform.
For installing OpenGL on ubuntu, just execute the following command (like installing any other thing) in
terminal:
Since OpenGL is a graphics API and not a platform of its own, it requires a language to operate in and
the language of choice is C++.
OpenGL primitives
OpenGL states
On/off (e.g., depth buffer test)
o glEnable( GLenum )
o glDisable( GLenum )
o Examples:
glEnable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
Mode States
o Once the mode is set the effect stays until reset
o Examples:
glShadeModel(GL_FLAT) or glShadeModel(GL_SMOOTH)
glLightModel(…) etc.
OpenGL provides a consistent interface to the underlying graphics hardware. This abstraction allows a
single program to run a different graphics hardware easily. A program written with OpenGL can even be
run in software (slowly) on machines with no graphics acceleration. OpenGL function names always begin
with gl, such as glClear(), and they may end with characters that indicate the types of the parameters, for
example glColor3f(GLfloat red, GLfloat green, GLfloat blue) takes three floating-point color parameters
and glColor4dv(const GLdouble *v) takes a pointer to an array that contains 4 double-precision floating-
point values. OpenGL constants begin with GL, such as GL DEPTH. OpenGL also uses special names for
types that are passed to its functions, such as GLfloat or GLint, the corresponding C types are compatible,
that is float and int respectively.
GLU is the OpenGL utility library. It contains useful functions at a higher level than those provided by
Department of Computer Engineering , ZCOER, Narhe, Pune-41 Page 29
Computer Graphics Laboratory (210248) Class: SE (Computer)
OpenGL, for example, to draw complex shapes or set up cameras. All GLU functions are written on top of
OpenGL. Like OpenGL, GLU function names begin with glu, and constants begin with GLU.
GLUT, the OpenGL Utility Toolkit, provides a system for setting up callbacks for interacting with the user and functions
for dealing with the windowing system. This abstraction allows a program to run on different operating systems with
only a recompile. Glut follows the convention of prepending function names with glut and constants with GLUT.
An OpenGL program using the three libraries listed above must include the appropriate headers.
This requires the following three lines:
#include <GL/gl.h> #include
<GL/glu.h> #include
<GL/glut.h>
Before OpenGL rendering calls can be made, some initialization has to be done. With GLUT, this
consists of initializing the GLUT library, initializing the display mode, creating the window, and setting
up callback functions. The following lines initialize a full color, double buffered display: glutInit(&argc,
argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
Double buffering means that there are two buffers, a front buffer and a back buffer. The front buffer is
displayed to the user, while the back buffer is used for rendering operations. This prevents flickering that
would occur if we rendered directly to the front buffer.
Next, a window is created with GLUT that will contain the viewport which displays the OpenGL front
buffer with the following three lines:
glutInitWindowPosition(px, py);
glutInitWindowSize(sx, sy);
glutCreateWindow(name);
To register callback functions, we simply pass the name of the function that handles the event to the
appropriate GLUT function.
glutReshapeFunc(reshape);
glutDisplayFunc(display);
Here, the functions should have the following prototypes:
void reshape(int width, int height); void
display();
In this example, when the user resizes the window, reshape is called by GLUT, and when the display needs to
be refreshed, the display function is called. For animation, an idle event handler that takes no arguments can be
created to call the display function to constantly redraw the scene with glutIdleFunc. Once all the callbacks
have been set up, a call to glutMainLoop allows the program torun.
In the display function, typically the image buffer is cleared, primitives are rendered to it, and the results are
presented to the user. The following line clears the image buffer, setting each pixel color to the clear color,
which can be configured to be anycolor:
glClear(GL_COLOR_BUFFER_BIT);
The next line sets the current rendering color to blue. OpenGL behaves like a state machine, so certain state
such as the rendering color is saved by OpenGL and used automatically later as it is needed.
Only a subset of OpenGL commands is available after a call to glBegin. The main command that is used is
glVertex, which specifies a vertex position. In GL LINES mode, each pair of vertices define endpoints of a
line segment. In this case, a line would be drawn from the point at ( x0, y0) to (x1, y1).
A call to glEnd completes rendering of the current primitive. glEnd(); Finally, the back buffer needs to be
swapped to the front buffer that the user will see, which GLUT can handle for us:
glutSwapBuffers();
Developer-Driven Advantages
Industry standard
An independent consortium, the OpenGL Architecture Review Board, guides the OpenGL specification.
With broad industry support, OpenGL is the only truly open, vendor-neutral, multiplatform graphics
standard.
Stable
OpenGL implementations have been available for more than seven years on a wide variety of platforms.
Additions to the specification are well controlled, and proposed updates are announced in time for developers
to adopt changes. Backward compatibility requirements ensure that existing applications do not become
obsolete.
Reliable and portable
All OpenGL applications produce consistent visual display results on any OpenGL API-compliant
hardware, regardless of operating system or windowing system.
Evolving
Because of its thorough and forward-looking design, OpenGL allows new hardware innovations to be
accessible through the API via the OpenGL extension mechanism. In this way, innovations appear in the API
in a timely fashion, letting application developers and hardware vendors
incorporate new features into their normal product release cycles.
Scalable
OpenGL API-based applications can run on systems ranging from consumer electronics to PCs,
workstations, and supercomputers. As a result, applications can scale to any class of machine that
Well-documented:
Numerous books have been published about OpenGL, and a great deal of sample code is readily
available, making information about OpenGL inexpensive and easy to obtain.
Conclusion:
Problem Statement:
Write a C++ program to implement bouncing ball using sine wave form. Apply the concept of
polymorphism.
Objective:
To understand and implement bouncing ball using sine wave form.
Outcome:
Implement concept of polymorphism.
Theory Concept:
What is animation?
Animation is the process of designing, drawing, making layouts and preparation of photographic sequences
which are integrated in the multimedia and gaming products. Animation involves the exploitation and
management of still images to generate the illusion of movement.
How to move an element to left, right, up and down using arrow keys?
To detect which arrow key is pressed, you can use ncurses.h header file. Arrow key's code is
defined as: KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT.
Conclusion: