0% found this document useful (0 votes)
68 views67 pages

CG Lab Manual 2020

Uploaded by

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

CG Lab Manual 2020

Uploaded by

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

CANARA ENGINEERING COLLEGE

BENJANAPADAVU

Department of Computer Science and Engineering

Laboratory Manual

SUBJECT: COMPUTER GRAPHICS


LABORATORY WITH MINI PROJECT
Subject Code: 17CSL68
CANARA ENGINEERING COLLEGE
DEPARTMENT OF COMPUTER SCIENCE &
ENGINEERING
VISION
To be recognized as a center of knowledge dissimilation in Computer Science and Engineering
by imparting value-added education to transform budding minds into competent computer
professionals.

MISSION
M1. Provide a learning environment enriched with ethics that helps in enhancing problem
solving skills of students and, cater to the needs of the society and industry.
M2. Expose the students to cutting-edge technologies and state-of-the-art tools in the many areas
of Computer Science & Engineering.
M3. Create opportunities for all round development of students through co-curricular and extra-
curricular activities.
M4. Promote research, innovation and development activities among staff and students.

PROGRAMME EDUCATIONAL OBJECTIVES


A. Graduates will work productively as computer science engineers exhibiting ethical qualities
and leadership roles in multidisciplinary teams.
B. Graduates will adapt to the changing technologies, tools and societal requirements.
C. Graduates will design and deploy software that meets the needs of individuals and the
industries
D. Graduates will take up higher education and/or be associated with the field so that they can
keep themselves abreast of Research & Development

PROGRAMME OUTCOMES
Engineering graduates in Computer Science and Engineering will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specific needs with appropriate
consideration for the public health and safety, and the cultural, societal and environmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods, including design of experiments, analysis and interpretation of data and synthesis of
the information to provide valid conclusions.
5. Modern tool usage: Select/Create and apply appropriate techniques, resources and modern
engineering and IT tools, including prediction and modeling to complex engineering
activities, taking comprehensive cognizance of their limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to
the professional engineering practice.
7. Environment and Sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts and demonstrate the knowledge of and need
for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the relevant scientific and/or engineering practices.
9. Individual and team work: Function effectively as an individual and as a member or leader
in diverse teams and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with the society-at-large, such as being able to comprehend and
write effective reports and design documentation, make effective presentations and give and
receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work as a member and
leader in a team to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for and above have the preparation and ability to
engage in independent and life-long learning in the broadcast context of technological
changes.

PROGRAMME SPECIFIC OUTCOMES


1. Computer System Design: Ability to apply the knowledge of computer system design
principles in building system software and hardware components.
2. Computer Communication and Internet Applications: Ability to apply knowledge of
layered network Models, their protocols and technologies in building network and Internet
based applications.
3. Solve Computational Problems: Apply the theoretical foundations of computer science in
modeling and developing solutions to the real world problems.
4. Software System Design and Development: Design and develop the application software
systems that meet the automation needs of society and industry.
COMPUTER GRAPHICS LABORATORY WITH MINI PROJECT

SEMESTER – VI

Subject Code 17CSL68

Number of Lecture Hours/Week 01I + 02P

Total Number of Lecture Hours 40

CREDITS – 02

Lab Experiments:

Design, develop, and implement the following programs using OpenGL API
1. Implement Brenham’s line drawing algorithm for all types of slope.
2. Create and rotate a triangle about the origin and a fixed point.
3. Draw a colour cube and spin it using OpenGL transformation matrices.
4. Draw a color cube and allow the user to move the camera suitably to experiment
with perspective viewing.
5. Clip a lines using Cohen-Sutherland algorithm
6. To draw a simple shaded scene consisting of a tea pot on a table. Define suitably the position and
properties of the light source along with the properties of the surfaces of the solid object used in
the scene.
7. Design, develop and implement recursively subdivide a tetrahedron to form 3D sierpinski gasket.
The number of recursive steps is to be specified by the user.
8. Develop a menu driven program to animate a flag using Bezier Curve algorithm
9. Develop a menu driven program to fill the polygon using scan line algorithm
PART –B ( MINI-PROJECT) :
Student should develop mini project on the topics mentioned below or similar applications
using Open GL API. Consider all types of attributes like color, thickness, styles, font,
background, speed etc., while doing mini project.
(During the practical exam: the students should demonstrate and answer Viva-Voce)
Conduction of Practical Examination:
1. All laboratory experiments from part A are to be included for practical
examination.
2. Mini project has to be evaluated for 40 Marks.
3. Report should be prepared in a standard format prescribed for project work.
4. Students are allowed to pick one experiment from the lot.
5. Strictly follow the instructions as printed on the cover page of answer script.
6. Marks distribution:
a) Part A: Procedure + Conduction + Viva: 09 + 42 + 09 = 60 Marks
b) Part B: Demonstration + Report + Viva voce = 20 + 14 + 06 = 40 Marks
7. Change of experiment is allowed only once and marks allotted to the procedure
part to be made zero.

Reference books:
1. Donald Hearn & Pauline Baker: Computer Graphics-OpenGL Version,3rd Edition, Pearson
Education,2011
2. Edward Angel: Interactive computer graphics- A Top Down approach with OpenGL,
5th edition. Pearson Education, 2011
3. M M Raikar, Computer Graphics using OpenGL, Fillip Learning / Elsevier,
Bangalore / New Delhi (2013)
Computer Graphics Laboratory with Mini Project 17CSL68

INTRODUCTION

OpenGL -- The Industry's Foundation for High Performance Graphics


OpenGL (Open Graphics Library) is a standard specification defining a cross-language, cross-
platform API for writing applications that produce 2D and 3D Computer graphics. The interface
consists of over 250 different function calls which can be used to draw complex three-
dimensional scenes from simple primitives.

OpenGL provides a powerful but primitive set of rendering commands, and all higher-level
drawing must be done in terms of these commands. Also, OpenGL programs have to use the
underlying mechanisms of the windowing system. A number of libraries exist to allow you to
simplify your programming tasks, including the following:

 The OpenGL Utility Library (GLU) contains several routines that use lower-level
OpenGL commands to perform such tasks as setting up matrices for specific viewing
orientations and projections, performing polygon tessellation, and rendering surfaces.
GLU routines use the prefix glu.

 For every window system, there is a library that extends the functionality of that window system
to support OpenGL rendering. For machines that use the X Window System, the OpenGL
Extension to the X Window System (GLX) is provided as an adjunct to OpenGL. GLX routines
use the prefix glX. For Microsoft Windows, the WGL routines provide the Windows to OpenGL
interface. All WGL routines use the prefix wgl. For IBM OS/2, the PGL is the Presentation
Manager to OpenGL interface, and its routines use the prefix pgl.

 The OpenGL Utility Toolkit (GLUT) is a window system-independent toolkit, written by


Mark Kilgard, to hide the complexities of differing window system APIs. Provides
functionality common to all window systems

o Open a window
o Get input from mouse and keyboard
o Menus
o Event-driven
Code is portable but GLUT lacks the functionality of a good toolkit for a specific
platform
o No slide bars
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 1
Computer Graphics Laboratory with Mini Project 17CSL68

 Open Inventor is an object-oriented toolkit based on OpenGL which provides objects and
methods for creating interactive three-dimensional graphics applications. Open Inventor,
which is written in C++, provides prebuilt objects and a built-in event model for user
interaction, high-level application components for creating and editing three-dimensional
scenes, and the ability to print objects and exchange data in other graphics formats. Open
Inventor is separate from OpenGL.

Working with Visual C++

1. Get glut.h, glut32.lib and glut32.dll from web.


2. Copy and paste the glut.h file in the C:\ProgramFiles\MicrosoftVisual
studio\VC\Include\GL folder.
3. Copy and paste the glut32.lib file in the C:\ProgramFiles\MicrosoftVisual studio\VC\Lib
folder.
4. Copy and paste the glut32.dll file in the C:\WINDOWS\system32
5. After following the above steps we can compile and edit a program on VC++ in the usual
way by creating a win32 console application project adding a c/ c++ source file to it,
editing our program and building it and later executing it.
OpenGL function format:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 2


Computer Graphics Laboratory with Mini Project 17CSL68

OpenGL #defines:
• Most constants are defined in the include files gl.h, glu.h and glut.h
Note #include <GL/glut.h> should automatically include the others
Examples
glBegin(GL_POLYGON)
glClear(GL_COLOR_BUFFER_BIT)
• include files also define OpenGL data types: GLfloat, GLdouble.

Program Structure
• Most OpenGL programs have a similar structure that consists of the following functions
main():
• defines the callback functions
• opens one or more windows with the required properties
• enters event loop (last executable statement)
init(): sets the state variables
• Viewing
• Attributes
callbacks:
• Display function
• Input and window functions

GLUT functions
• glutInit allows application to get command line arguments and initializes system
• gluInitDisplayMode requests properties for the window (the rendering context)
RGB color
Single buffering
Properties logically ORed together

• glutWindowSize in pixels
• glutWindowPosition from top-left corner of display

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 3


Computer Graphics Laboratory with Mini Project 17CSL68

• glutCreateWindow create window with title “simple demo”


• glutDisplayFunc display callback
• glutMainLoop enter infinite event loop

OpenGL. Primitives and their type specifications include the following:

Line segments (GL_LINES): The line-segment type causes successive pairs of vertices to be
interpreted as the endpoints of individual segments. Because the interpretation is done on a pair
wise basis, successive segments usually are disconnected.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 4


Computer Graphics Laboratory with Mini Project 17CSL68

Polylines (GL_LINE_STRIP): It is used if successive vertices (and line segments) are to be


connected. Many curves can be approximated via a suitable polyline.
GL_LINE_LOOP: If the polyline need to be closed the final vertex is located in the same place
as the first, or GL_LINE_LOOP can be used which will draw a line segment from the final
vertex to the first, thus creating a closed path.

Polygons (GL_POLYGON):
 Successive vertices define line segments, and a line segment connects the final
vertex to the first.
 The interior is filled according to the state of the relevant attributes.
 Note that a mathematical polygon has an inside and an outside that are separated
by the edge. The edge itself has no width.
 Consequently, most graphics systems allow to fill the polygon with a color or
pattern or to draw lines around the edges, but not to do both.
 In OpenGL, glPolygonMode function can be used to select edges instead of fill
(the default).
 However, to draw a filled polygon and to display its edges, it must be drawn twice,
once in each mode, or a polygon and a line loop with the same vertices must be
drawn.
 Triangles and Quadrilaterals (GL_TRIANGLES, GL_QUADS):
 These objects are special cases of polygons. Successive groups of three and four
vertices are interpreted as triangles and quadrilaterals, respectively.
 Using these types may lead to a rendering more efficient than that obtained with
polygons.
 Stripsand Fans (GLTRIANGLE_STRIP, GL_QUAD_STRIP,
GL_TRIANGLE_FAN) :
 These objects are based on groups of triangles or quadrilaterals that share vertices
and edges.
 In the triangle_strip, for example, each additional vertex is combined with the
previous two vertices to define a new triangle.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 5


Computer Graphics Laboratory with Mini Project 17CSL68

 For the quad_strip, two new vertices are combined with the previous two vertices
to define a new quadrilateral.
 A triangle fan is based on one fixed point. The next two points determine the first
triangle, and subsequent triangles are formed from one new point, the previous
point, and the first (fixed) point.

Basics 1: Plotting Points using the primitives GL_POINTS

* Note that the program defines a display callback function named display
Every glut program must have a display callback
The display callback is executed whenever OpenGL decides the display must be refreshed, for
example when the window is opened
The main function ends with the program entering an event loop.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 6


Computer Graphics Laboratory with Mini Project 17CSL68

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 7


Computer Graphics Laboratory with Mini Project 17CSL68

Basics 2: Drawing lines, displaying text part of picture.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 8


Computer Graphics Laboratory with Mini Project 17CSL68

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 9


Computer Graphics Laboratory with Mini Project 17CSL68

PART-A

1. Design, develop, and implement Brenham’s line drawing algorithm for all types of slope in
C/C++ using OpenGL API.

Algorithm:

Bresenham's algorithm is generalized to lines with arbitrary slope by considering the


symmetry between the various octants and quadrants of the xy plane. For a line with positive
slope greater than 1, we intelrhange the roles of the x and y directions. That is, we step along
they direction in unit steps and calculate successive x values nearest the line path. Also, we
could revise the program to plot pixels starting from either endpoint.

If the initial position for a line with positive slope is the right endpoint, both x and y
decrease as we step from right to left. To ensure that the same pixels are plotted regardless of
the starting endpoint, we always choose the upper (or the lower) of the two candidate pixels
whenever the two vertical separations from the line path are equal (d1 = d2).

For negative slopes, the procedures are similar, except that now one coordinate
decreases as the other increases. Finally, special cases can be handled separately: Horizontal
lines (Δy = 0), vertical lines (Δx = 0), and diagonal lines with (|Δy| = |Δx|) each can be loaded
directly into the frame buffer without processing them through the line-plotting algorithm.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 10


Computer Graphics Laboratory with Mini Project 17CSL68

Program:

// Bresenham's Line Drawing


#include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>
int x1, y1, x2, y2;
void myInit()
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 500, 0, 500);
}

void draw_pixel(int x, int y)


{
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
}

void draw_line(int x1, int x2, int y1, int y2)


{
int dx, dy, i, e;
int incx, incy, inc1, inc2;
int x,y;
dx = x2-x1;
dy = y2-y1;
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
incx = 1;
if (x2 < x1) incx = -1;
incy = 1;
if (y2 < y1) incy = -1;
x = x1; y = y1;
if (dx > dy)

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 11


Computer Graphics Laboratory with Mini Project 17CSL68

{
draw_pixel(x, y);
e = 2 * dy-dx;
inc1 = 2*(dy-dx);
inc2 = 2*dy;
for (i=0; i<dx; i++)
{
if (e >= 0)
{
y += incy;
e += inc1;
}
else
e += inc2;
x += incx;
draw_pixel(x, y);
}
}
else
{
draw_pixel(x, y);
e = 2*dx-dy;
inc1 = 2*(dx-dy);
inc2 = 2*dx;
for (i=0; i<dy; i++)
{
if (e >= 0)
{
x += incx;
e += inc1;
}
else
e += inc2;
y += incy;
draw_pixel(x, y);
}
}
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 12


Computer Graphics Laboratory with Mini Project 17CSL68

void myDisplay()
{
draw_line(x1, x2, y1, y2);
glFlush();
}

int main(int argc, char **argv)


{
printf( "Enter (x1, y1, x2, y2)\n");
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("Bresenham's Line Drawing");
myInit();
glutDisplayFunc(myDisplay);
glutMainLoop();
return 0;
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 13


Computer Graphics Laboratory with Mini Project 17CSL68

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 14


Computer Graphics Laboratory with Mini Project 17CSL68

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 15


Computer Graphics Laboratory with Mini Project 17CSL68

2. Design, develop, and implement a program in C/C++ to create and rotate a triangle about
the origin and a fixed point, using OpenGL API.

Program:
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int x,y;
int rFlag=0;

void draw_pixel(float x1,float y1)


{
glColor3f(0.0,0.0,1.0);
glPointSize(5.0);
glBegin(GL_POINTS);
glVertex2f(x1,y1);
glEnd();
}

void triangle()
{
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(100,100);
glVertex2f(250,400);
glVertex2f(400,100);
glEnd();
}

float th=0.0;
float trX=0.0,trY=0.0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();

if(rFlag==1) //Rotate Around origin


{
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 16
Computer Graphics Laboratory with Mini Project 17CSL68

trX=0.0; trY=0.0; th+=0.1;


draw_pixel(0.0,0.0);
}
if(rFlag==2) //Rotate Around Fixed Point
{
trX=x; trY=y; th+=0.1;
draw_pixel(x,y);
}
glTranslatef(trX,trY,0.0);
glRotatef(th,0.0,0.0,1.0);
glTranslatef(-trX,-trY,0.0);
triangle();
glutPostRedisplay();
glutSwapBuffers();
}

void myInit()
{
glClearColor(0.0,0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-500.0, 500.0, -500.0, 500.0);
glMatrixMode(GL_MODELVIEW);
}

void rotateMenu (int option)


{
if(option==1)
rFlag=1;
if(option==2)
rFlag=2;
if(option==3)
rFlag=3;
}

int main(int argc, char **argv)


{

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 17


Computer Graphics Laboratory with Mini Project 17CSL68

printf( "Enter Fixed Points (x,y) for Roration: \n");


scanf("%d %d", &x, &y);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("Create and Rotate Triangle");
myInit();
glutDisplayFunc(display);
glutCreateMenu(rotateMenu);
glutAddMenuEntry("Rotate around ORIGIN",1);
glutAddMenuEntry("Rotate around FIXED POINT",2);
glutAddMenuEntry("Stop Rotation",3);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 18


Computer Graphics Laboratory with Mini Project 15CSL68
17CSL68

Before Rotation

Rotation about the origin

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 19


Computer Graphics Laboratory with Mini Project 17CSL68

Rotation about a Fixed Point

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 20


Computer Graphics Laboratory with Mini Project 17CSL68

3. Design, develop, and implement a program in C/C++ to draw a color cube and spin it using
OpenGL transformation matrices, using OpenGL API.

A cube with an edge length of 1. Subscript values for array

Program:

#include<stdio.h>
#include<GL/glut.h>

GLfloat vertices[][3]=
{
{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},
{1.0,1.0,-1.0},{-1.0,1.0,-1.0},
{-1.0,-1.0,1.0},{1.0,-1.0,1.0},
{1.0,1.0,1.0},{-1.0,1.0,1.0}
};

GLfloat colors[][3]=
{
{0.0,0.0,0.0},{0,0.0,0.0},
{1.0,1.0,0.0},{0.0,1.0,1.0},

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 21


Computer Graphics Laboratory with Mini Project 17CSL68

{0.0,0.0,1.0},{1.0,0.0,1.0},
{1.0,1.0,1.0},{0.0,1.0,1.0}
};

void polygon(int a,int b,int c,int d)


{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(vertices[a]);

glColor3fv(colors[b]);
glVertex3fv(vertices[b]);

glColor3fv(colors[c]);
glVertex3fv(vertices[c]);

glColor3fv(colors[d]);
glVertex3fv(vertices[d]);
glEnd();
}
void colorcube(void)
{
polygon(0,3,2,1);
polygon(2,3,7,6);
polygon(0,4,7,3);
polygon(1,2,6,5);
polygon(4,5,6,7);
polygon(0,1,5,4);
//similarly for remaining 5 faces
}

static GLfloat theta[]={0.0,0.0,0.0};


static GLint axis=2;

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 22


Computer Graphics Laboratory with Mini Project 17CSL68

glLoadIdentity();
glRotatef(theta[0],1.0,0.0,0.0);//for x axis
glRotatef(theta[1],0.0,1.0,0.0);
glRotatef(theta[2],0.0,0.0,1.0);
colorcube();
glutSwapBuffers();
}

void spinCube()
{
theta[axis]+=0.1;
if(theta[axis]>360.0) theta[axis]-=360.0;
glutPostRedisplay();
}

void mouse(int btn,int state,int x,int y)


{
if(btn==GLUT_LEFT_BUTTON&&state==GLUT_DOWN)axis=0;//x axis rotation
if(btn==GLUT_MIDDLE_BUTTON&&state==GLUT_DOWN)axis=1;//y axis rotn
if(btn==GLUT_RIGHT_BUTTON&&state==GLUT_DOWN)axis=2;
}

void myReshape(int w,int h) // common reshape func for all prgrms


{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
glOrtho(-2.0,2.0,-2.0*(GLfloat)h/(GLfloat)w,2.0*(GLfloat)h/(GLfloat)w,-10.0,10.0);
else
glOrtho(-2.0*(GLfloat)w/(GLfloat)h,2.0*(GLfloat)w/(GLfloat)h,-2.0,2.0,-10.0,10.0);
glMatrixMode(GL_MODELVIEW);
}

int main(int argc,char** argv)


{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 23


Computer Graphics Laboratory with Mini Project 17CSL68

glutInitWindowSize(500,500);
glutCreateWindow("color cube viewer");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutIdleFunc(spinCube);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
return 0;
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 24


Computer Graphics Laboratory with Mini Project 17CSL68

4. Design, develop, and implement a program in C/C++ to Draw a color cube and allow the
user to move the camera suitably to experiment with perspective viewing, using OpenGL API.

Program:

#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glut.h>

GLfloat vertices[][3] = {{-1,-1,-1},{1,-1,-1}, {1,1,-1},{-1,1,-1},


{-1,-1,1},{1,-1,1},{1,1,1},{-1,1,1}};

GLfloat colors[][3] = {{1,0,0},{1,1,0},{0,1,0},{0,0,1},


{1,0,1},{1,1,1},{0,1,1},{0.5,0.5,0.5}};

void polygon(int a, int b, int c , int d)


{
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(vertices[a]);
glColor3fv(colors[b]);
glVertex3fv(vertices[b]);
glColor3fv(colors[c]);
glVertex3fv(vertices[c]);
glColor3fv(colors[d]);
glVertex3fv(vertices[d]);
glEnd();
}

void colorcube(void)
{
polygon(0,3,2,1);
polygon(0,4,7,3);
polygon(5,4,0,1);
polygon(2,3,7,6);
polygon(1,2,6,5);
polygon(4,5,6,7);
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 25


Computer Graphics Laboratory with Mini Project 17CSL68

GLfloat theta[] = {0.0,0.0,0.0}; GLint axis = 2;


GLdouble viewer[]= {0.0, 0.0, 5.0}; /* initial viewer location */

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(viewer[0],viewer[1],viewer[2], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glRotatef(theta[0], 1.0, 0.0, 0.0);
glRotatef(theta[1], 0.0, 1.0, 0.0);
glRotatef(theta[2], 0.0, 0.0, 1.0);
colorcube();
glFlush();
glutSwapBuffers();
}

void mouse(int btn, int state, int x, int y)


{
if(btn==GLUT_LEFT_BUTTON && state == GLUT_DOWN)
axis = 0;
if(btn==GLUT_MIDDLE_BUTTON && state == GLUT_DOWN)
axis = 1;
if(btn==GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
axis = 2;
theta[axis] += 2.0;
if( theta[axis] > 360.0 )
theta[axis] -= 360.0;
display();
}

void keys(unsigned char key, int x, int y)


{
if(key == 'x')
viewer[0]-= 1.0;
if(key == 'X')
viewer[0]+= 1.0;
if(key == 'y')
viewer[1]-= 1.0;

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 26


Computer Graphics Laboratory with Mini Project 17CSL68

if(key == 'Y')
viewer[1]+= 1.0;
if(key == 'z')
viewer[2]-= 1.0;
if(key == 'Z')
viewer[2]+= 1.0;
display();
}

void myReshape(int w, int h)


{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
glFrustum(-2.0, 2.0, -2.0 * (GLfloat) h/ (GLfloat) w, 2.0* (GLfloat) h /(GLfloat) w,2.0, 20.0);
else
glFrustum(-2.0, 2.0, -2.0 * (GLfloat) w/ (GLfloat) h, 2.0* (GLfloat) w / (GLfloat) h, 2.0, 20.0);
glMatrixMode(GL_MODELVIEW);
}

int main(int argc, char **argv)


{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutCreateWindow("Colorcube Viewer");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutKeyboardFunc(keys);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 27


Computer Graphics Laboratory with Mini Project 17CSL68

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 28


Computer Graphics Laboratory with Mini Project 17CSL68

5. Design, develop, and implement a program in C/C++ to Clip a line using Cohen-Sutherland
algorithm, using OpenGL API.

Algorithm

The Cohen-Sutherland algorithm uses a divide-and-conquer strategy. The line segment's


endpoints are tested to see if the line can be trivially accepted or rejected. If the line cannot be
trivially accepted or rejected, an intersection of the line with a window edge is determined and
the trivial reject/accept test is repeated. This process is continued until the line is accepted.

To perform the trivial acceptance and rejection tests, we extend the edges of the window to
divide the plane of the window into the nine regions. Each end point of the line segment is then
assigned the code of the region in which it lies.

1. Given a line segment with endpoint P1 = (x1, y1) and P1 = (x2, y2)
2. Compute the 4-bit codes for each endpoint.

If both codes are 0000,(bitwise OR of the codes yields 0000 ) line lies completely inside
the window: pass the endpoints to the draw routine.

If both codes have a 1 in the same bit position (bitwise AND of the codes is not 0000),
the line lies outside the window. It can be trivially rejected.

3. If a line cannot be trivially accepted or rejected, at least one of the two endpoints must
lie outside the window and the line segment crosses a window edge. This line must
be clipped at the window edge before being passed to the drawing routine.
4. Examine one of the endpoints, say P1 = (x1, y1) Read P1's 4-bit code in order: Left-to-
Right, Bottom-to-Top.
5. When a set bit (1) is found, compute the intersection I of the corresponding window
edge with the line from P1 to P2 . Replace P1 with I and repeat the algorithm.

If the line cannot be trivially accepted or rejected, we must compute the intersection of the line
with an appropriate window edge.

We need two equations for the line

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 29


Computer Graphics Laboratory with Mini Project 17CSL68

Find the intersection with the top edge of the window:

Then, find the intersection with the bottom edge:

Now, find the intersection with the left edge:

Finally, find the intersection with the right edge:

There is no significance in the sequence of which edge to examine.

Program:

#include <stdio.h>
#include <GL/gl.h>
#include <GL/glut.h>
#define outcode int

double xmin=50,ymin=50, xmax=100,ymax=100; // Window boundaries


//bit codes for the top,bottom,right & left
const int TOP = 1;
const int BOTTOM = 2;
const int RIGHT = 4;
const int LEFT = 8;

//used to compute bit codes of a point


outcode ComputeOutCode (double x, double y);

//Cohen-Sutherland clipping algorithm clips a line from P0 = (x0, y0) to P1 = (x1, y1)

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 30


Computer Graphics Laboratory with Mini Project 17CSL68

//against a rectangle with diagonal from (xmin, ymin) to (xmax, ymax).


void CohenSutherlandLineClipAndDraw (double x0, double y0,double x1, double y1)
{
//Outcodes for P0, P1, and whatever point lies outside the clip rectangle
outcode outcode0, outcode1, outcodeOut;
bool accept = false, done = false;
//compute outcodes
outcode0 = ComputeOutCode (x0, y0);
outcode1 = ComputeOutCode (x1, y1);
do
{
if (!(outcode0 | outcode1)) //logical or is 0 Trivially accept & exit
{
accept = true;
done = true;
}
else if (outcode0 & outcode1) //logical and is not 0. Trivially reject & exit
done = true;
else
{ //failed both tests, so calculate the line segment to clip from an
// outside point to an intersection with clip edge
double x, y;
//At least one endpoint is outside the clip rectangle; pick it.
outcodeOut = outcode0? outcode0: outcode1;
//Now find the intersection point;
//use formulas y = y0 + slope * (x - x0), x = x0 + (1/slope)* (y - y0)
if (outcodeOut & TOP) //point is above the clip rectangle
{
x = x0 + (x1 - x0) * (ymax - y0)/(y1 - y0);
y = ymax;
}
else if (outcodeOut & BOTTOM) //point is below the clip rectangle
{
x = x0 + (x1 - x0) * (ymin - y0)/(y1 - y0);
y = ymin;
}
else if (outcodeOut & RIGHT)//point is to the right of clip rectangl
{
y = y0 + (y1 - y0) * (xmax - x0)/(x1 - x0);
x = xmax;
}
else //point is to the left of clip rectangle
{
y = y0 + (y1 - y0) * (xmin - x0)/(x1 - x0);
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 31
Computer Graphics Laboratory with Mini Project 17CSL68

x = xmin;
}
//Now we move outside point to intersection point to clip
//and gets ready for next pass.
if (outcodeOut == outcode0)
{
x0 = x;
y0 = y;
outcode0 = ComputeOutCode (x0, y0);
}
else
{
x1 = x;
y1 = y;
outcode1 = ComputeOutCode (x1, y1);
}
}
} while (!done);
if (accept)
{
//draw a red colored viewport
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(xmin+200, ymin+200);
glVertex2f(xmax+200, ymin+200);
glVertex2f(xmax+200, ymax+200);
glVertex2f(xmin+200, ymax+200);
glEnd();
glColor3f(0.0,0.0,1.0); // draw blue colored clipped line
glBegin(GL_LINES);
glVertex2d (x0+200, y0+200);
glVertex2d (x1+200, y1+200);
glEnd();
}
}

//Compute the bit code for a point (x, y) using the clip rectangle
//bounded diagonally by (xmin, ymin), and (xmax, ymax)
outcode ComputeOutCode (double x, double y)
{
outcode code = 0;
if (y > ymax) //above the clip window
code |= TOP;
else if (y < ymin) //below the clip window
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 32
Computer Graphics Laboratory with Mini Project 17CSL68

code |= BOTTOM;
if (x > xmax) //to the right of clip window
code |= RIGHT;
else if (x < xmin) //to the left of clip window
code |= LEFT;
return code;
}

void display()
{
double x0=120,y0=10,x1=40,y1=130;
glClear(GL_COLOR_BUFFER_BIT);
//draw the line with red color
glColor3f(1.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2d (x0, y0);
glVertex2d (x1, y1);
glVertex2d (10,70);
glVertex2d (250,90);
glEnd();
//draw a blue colored window
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_LINE_LOOP);
glVertex2d(xmin, ymin);
glVertex2d(xmax, ymin);
glVertex2d(xmax, ymax);
glVertex2d(xmin, ymax);
glEnd();
CohenSutherlandLineClipAndDraw(x0,y0,x1,y1);
CohenSutherlandLineClipAndDraw(10,70,250,90);
glFlush();
}

void myInit()
{
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(1.0,0.0,0.0);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,499.0,0.0,499.0);
}

int main(int argc, char** argv)


Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 33
Computer Graphics Laboratory with Mini Project 17CSL68

{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Cohen Sutherland Line Clipping Algorithm");
glutDisplayFunc(display);
myInit();
glutMainLoop();
return 0;
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 34


Computer Graphics Laboratory with Mini Project 17CSL68

6. Design, develop, and implement a program in C/C++ to draw a simple shaded scene
consisting of a tea pot on a table. Define suitably the position and properties of the light
source along with the properties of the surfaces of the solid object used in the scene, using
OpenGL API.

Program:

#include<GL/glut.h>

void wall(double thickness)


{
glPushMatrix();
glTranslated(0.5,0.0,0.5);
glScaled(1.0,thickness,1.0);
glutSolidCube(1.0);
glPopMatrix();
}
void tableLeg(double thick,double len)
{
glPushMatrix();
glTranslated(0,len/2,0);
glScaled(thick,len,thick);
glutSolidCube(1.0);
glPopMatrix();
}
void table(double topWid,double topThick,double legThick,double legLen)
{
glPushMatrix();
glTranslated(0,legLen,0);
glScaled(topWid,topThick,topWid);
glutSolidCube(1.0);
glPopMatrix();
double dist=0.95*topWid/2.0-legThick/2.0;
glPushMatrix();
glTranslated(dist,0,dist);
tableLeg(legThick,legLen);
glTranslated(0.0,0.0,-2*dist);
tableLeg(legThick,legLen);
glTranslated(-2*dist,0,2*dist);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 35


Computer Graphics Laboratory with Mini Project 17CSL68

tableLeg(legThick,legLen);
glTranslated(0,0,-2*dist);
tableLeg(legThick,legLen);
glPopMatrix();
}

void displaySolid(void)
{
GLfloat mat_ambient[]={0.7f,0.7f,0.7f,1.0f};
GLfloat mat_diffuse[]={.5f,.5f,.5f,1.0f};
GLfloat mat_specular[]={1.0f,1.0f,1.0f,1.0f};
GLfloat mat_shininess[]={50.0f};
glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);
GLfloat lightIntensity[]={0.7f,0.7f,0.7f,1.0f};
GLfloat light_position[]={2.0f,6.0f,3.0f,0.0f};
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glLightfv(GL_LIGHT0,GL_DIFFUSE,lightIntensity);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.3,1.3,-1.3,1.3,0.1,100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(2.3,1.3,2.0,0.0,0.25,0.0,0.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(0.4,0.38,0.45);
glRotated(30,0,1,0);
glutSolidTeapot(0.10);
glPopMatrix();
glPushMatrix();
glTranslated(0.4,0,0.4);
table(0.6,0.02,0.02,0.3);
glPopMatrix();
wall(0.02);
glPushMatrix();

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 36


Computer Graphics Laboratory with Mini Project 17CSL68

glRotated(90.0,0.0,0.0,1.0);
wall(0.02);
glPopMatrix();
glPushMatrix();
glRotated(-90.0,1.0,0.0,0.0);
wall(0.02);
glPopMatrix();
glFlush();
}

int main(int argc,char**argv)


{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("simple shaded scene consisting of a tea pot on a table");
glutDisplayFunc(displaySolid);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glClearColor(1.1,1.1,1.1,1.0);
glViewport(0,0,640,480);
glutMainLoop();
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 37


Computer Graphics Laboratory with Mini Project 17CSL68

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 38


Computer Graphics Laboratory with Mini Project 17CSL68

7. Design, develop, and implement a program in C/C++ to recursively subdivide a tetrahedron


to form 3D Sierpinski gasket, using OpenGL API. The number of recursive steps is to be
specified by the user.

Algorithm:

Step 1: Specify the four vertices that form a tetrahedron

Step 2: Input the number of subdivisions n.

Step 3: Select any three vertices that form one of the triangular faces of the tetrahedron

Step 4: Find the mid-points of the edges that form the triangular face

Step 5: Subdivide the triangular face by drawing three triangles using the original vertices and
the midpoints.

Step 6: Decrement n by one

Step 7: if n ≠ 0, then select each newly formed triangle and subdivide them recursively.

Step 8: if n ==0, select the next three set of original vertices that form the tetrahedron and
repeat the steps 4 to 7.

Program:

#include <stdio.h>
#include <GL/glut.h>

/* initial tetrahedron */
typedef float point[3];
point v[] = { {0.0,0.0,-0.0},
{0.0,0.9,-1.0},
{-0.8,-0.4,-1.0},
{0.8,-0.4,-1.0}
};

int n;

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 39


Computer Graphics Laboratory with Mini Project 17CSL68

//Display individual triangles


void triangle(point a,point b,point c)
{
glBegin(GL_POLYGON);
glVertex3fv(a);
glVertex3fv(b);
glVertex3fv(c);
glEnd();
}
//Triangle Subdivision
void divide_triangle(point a,point b,point c,int m)
{
point v1, v2, v3;
int j;
if (m > 0)
{
for (j = 0; j < 3; j++)
{
v1[j] = (a[j] + b[j]) / 2;
v2[j] = (a[j] + c[j]) / 2;
v3[j] = (b[j] + c[j]) / 2;
}
divide_triangle(a,v1,v2,m-1);
divide_triangle(c,v2,v3,m-1);
divide_triangle(b,v3,v1,m-1);
}
else
{
triangle(a,b,c);
}
}

//tetrahedron
void tetrahedron(int m)
{
glColor3f(1.0,0.0,0.0);
divide_triangle(v[0],v[1],v[2],m);
glColor3f(0.0, 1.0, 0.0);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 40


Computer Graphics Laboratory with Mini Project 17CSL68

divide_triangle(v[3], v[2], v[1], m);


glColor3f(0.0, 0.0, 1.0);
divide_triangle(v[0], v[3], v[1], m);
glColor3f(0.0, 0.0, 0.0);
divide_triangle(v[0], v[2], v[3], m);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
tetrahedron(n);
glFlush();
}

void myReshape(int w, int h)


{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-2.0, 2.0, -2.0*(GLfloat)h / (GLfloat)w,2.0*(GLfloat)h / (GLfloat)w,-10.0,10.0);
else
{
glOrtho(-2.0*(GLfloat)w / (GLfloat)h,2.0*(GLfloat)w / (GLfloat)h, -2.0, 2.0, -10.0, 10.0);
}
glMatrixMode(GL_MODELVIEW);
glutPostRedisplay();
}

int main(int argc,char **argv)


{
printf("Enter the number of Divisions:\n");
scanf("%d",&n);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(500, 500);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 41


Computer Graphics Laboratory with Mini Project 17CSL68

glutInitWindowPosition(0,0);
glutCreateWindow("3D Gasket");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glClearColor(1.0,1.0,1.0,1.0);
glutMainLoop();
return 0;
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 42


Computer Graphics Laboratory with Mini Project 17CSL68

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 43


Computer Graphics Laboratory with Mini Project 17CSL68

8. Design, develop, and implement a menu driven program to animate a flag using Bezier
Curve algorithm, using OpenGL API.

Description:

Bezier curve section can be fitted to any number of control points. The number of
control points to be approximated and their relative position determine the degree of the
Bezier polynomial. As with the interpolation splines, a bezier curve can be specified with
boundary conditions, with a characterizing matrix, or with blending functions. For general
Bezier curves, the blending-function specification is the most convenient.

Suppose we are given n + 1 control-point positions: pk = (xk, yk, zk), with k varying from 0
to n. These coordinate points can be blended to produce the following position vector P(u),
which describes the path of an approximating BCzier polynomial function between p0 and pn.

The Bezier blending functions BEZk,n(u) are the Bernstein polynomials:

where the C(n, k) are the binomial coefficients:

Equivalently, we can define Bezier blending functions with the recursive calculation

with BEZk,k = uk , and BEZ0,k= (1 - u )k.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 44


Computer Graphics Laboratory with Mini Project 17CSL68

The first equation represents a set of three parametric equations for the individual curve
coordinates:

As a rule, a bezier curve is a polynomial of degree one less than the number of control points
used: Three points generate a parabola, four points a cubic curve, and so forth.

Efficient methods for determining coordinate positions along a Bezier curve can be set up using
recursive calculations. For example, successive binomial coefficients can be calculated as

Program:

#include<GL/gl.h>
#include<GL/glut.h>
#include<stdio.h>
#include<math.h>
#define PI 3.1416

void bino(int n, int *C)


{
int k, j;
for(k=0;k<=n;k++)
{
C[k]=1;
for(j=n;j>=k+1; j--)
C[k]*=j;
for(j=n-k;j>=2;j--)
C[k]/=j;
}
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 45


Computer Graphics Laboratory with Mini Project 17CSL68

void bezier(int *c,int cp[][2],int n)


{
float x,y,u,blend;
int k;
glBegin(GL_POINTS);
for(u=0;u<1.0;u+=0.01)
{
x=0;y=0;
for(k=0;k<4;k++)
{
blend=c[k]*pow(u,k)*pow(1-u,n-k);
x+=cp[k][0]*blend;
y+=cp[k][1]*blend;
}
glVertex2f(x,y);
}
glEnd();
}

float theta = 0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
int c[4],k,n=3;

int cp[4][2]={{100,400},{150,450},{250,350},{300,400}};

cp[1][0] +=50*sin(theta * PI/180.0);


cp[1][1] +=25*sin(theta * PI/180.0);
cp[2][0] -= 50*sin((theta+30) * PI/180.0);
cp[2][1] -= 50*sin((theta+30) * PI/180.0);
cp[3][0] -= 25*sin((theta) * PI/180.0);
cp[3][1] += sin((theta-30) * PI/180.0);

theta+=10.0;

glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glPointSize(5);
bino(n,c);

glPushMatrix();
glLineWidth(5);
glColor3f(1, 0.4, 0.2); //Indian flag: Orange color code for(int i=0;i<50;i++)
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 46
Computer Graphics Laboratory with Mini Project 17CSL68

for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(c,cp,n);
}

glColor3f(1, 1, 1); //Indian flag: white color code for(int i=0;i<50;i++)


for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(c,cp,n);
}

glColor3f(0, 1, 0);
for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(c,cp,n);
}
glPopMatrix();

glColor3f(0.7, 0.5,0.3);
glLineWidth(5);
glBegin(GL_LINES);
glVertex2f(100,400);
glVertex2f(100,40);
glEnd();

glutPostRedisplay();
glutSwapBuffers();
}

void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,500,0,500);
}

int main(int argc, char **argv)


{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowPosition(0, 0);
Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 47
Computer Graphics Laboratory with Mini Project 17CSL68

glutInitWindowSize(500,500);
glutCreateWindow("Bezier Curve");
init();
glutDisplayFunc(display);
glutMainLoop();
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 48


Computer Graphics Laboratory with Mini Project 17CSL68

10. Design, develop, and implement a menu driven program to fill the polygon using scan line
algorithm using OpenGL API.

Algorithm:

1. Set y to the smallest y coordinate that has an entry in the ET; i.e, y for the first nonempty
bucket.
2. Initialize the AET to be empty.
3. Repeat until the AET and ET are empty:
3.1 Move from ET bucket y to the AET those edges whose y_min = y (entering edges).
3.2 Remove from the AET those entries for which y = y_max (edges not involved in the
next scanline), the sort the AET on x (made easier because ET is presorted).
3.3 Fill in desired pixel values on scanline y by using pairs of x coordinates from AET.
3.4 Increment y by 1 (to the coordinate of the next scanline).
3.5 For each nonvertical edge remaining in the AET, update x for the new y.

Program:

#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#include <windows.h>

float x1,x2,x3,x4,y1,y2,y3,y4;
int fillFlag=0;

void edgedetect(float x1,float y1,float x2,float y2,int *le,int *re)


{
float mx,x,temp;
int i;
if((y2-y1)<0)
{
temp=y1;y1=y2;y2=temp;
temp=x1;x1=x2;x2=temp;
}
if((y2-y1)!=0)
mx=(x2-x1)/(y2-y1);
else
mx=x2-x1;

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 49


Computer Graphics Laboratory with Mini Project 17CSL68

x=x1;
for(i=y1;i<=y2;i++)
{
if(x<(float)le[i])
le[i]=(int)x;
if(x>(float)re[i])
re[i]=(int)x;
x+=mx;
}
}

void draw_pixel(int x,int y)


{
glColor3f(1.0,1.0,0.0);
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
}

void scanfill(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4)
{
int le[500],re[500];
int i,y;
for(i=0;i<500;i++)
{
le[i]=500;
re[i]=0;
}
edgedetect(x1,y1,x2,y2,le,re);
edgedetect(x2,y2,x3,y3,le,re);
edgedetect(x3,y3,x4,y4,le,re);
edgedetect(x4,y4,x1,y1,le,re);
for(y=0;y<500;y++)
{
for(i=(int)le[y];i<(int)re[y];i++)
draw_pixel(i,y);
}
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 50


Computer Graphics Laboratory with Mini Project 17CSL68

void display()
{
x1=200.0;y1=200.0;x2=100.0;y2=300.0;x3=200.0;y3=400.0;x4=300.0;y4=300.0;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_LINE_LOOP);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
glVertex2f(x3,y3);
glVertex2f(x4,y4);
glEnd();
if(fillFlag==1)
scanfill(x1,y1,x2,y2,x3,y3,x4,y4);
glFlush();
}

void init()
{
glClearColor(0.0,0.0,0.0,1.0);
glColor3f(1.0,0.0,0.0);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,499.0,0.0,499.0);
}

void fillMenu(int option)


{
if(option==1)
fillFlag=1;
if(option==2)
fillFlag=2;
display();
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 51


Computer Graphics Laboratory with Mini Project 17CSL68

int main(int argc, char* argv[])


{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Filling a Polygon using Scan-line Algorithm");
init();
glutDisplayFunc(display);
glutCreateMenu(fillMenu);
glutAddMenuEntry("Fill Polygon",1);
glutAddMenuEntry("Empty Polygon",2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
}

Output:

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 52


Computer Graphics Laboratory with Mini Project 17CSL68

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 53


Computer Graphics Laboratory with Mini Project 17CSL68

Viva questions
1. Explain all the OpenGL functions used in this program?
2. What is the principle of Sierpinski gasket?
3. Difference between additive and subtractive color?
4. What is the Graphics Architecture used in OpenGL?
5. What is Rasterisation?
6. Explain sierpinski Gasket (using points).
7. Explain sierpinski Gasket (using polye )
8. Difference between 2D Tetrohedron and 3D Tetrahedron.
9. What do you mean by clipping?
10. How is Liang-Barsky clipping different from CohenSutherland Clipping Algorithm?
11. How do you set the color attributes in Opengl?
12. What is the command for clearscreen?
13. What is Event callback function?
14. Explain Liang-Barsky line clipping algorithm?
15. Explain window to viewpoint mapping?
16. What are vertex arrays?
17. How are the faces of the color cube modeled?
18. How do you consider the inward and outward pointing of the faces?
19. Explain the OpenGL function used to rotate the color cube?
20. What is the difference between 2D and 3D orthographic projection statements?
21. Explain the Inward and Outward pointing face?
22. Explain the data structure for object representation?
23. Explain the vertex list representation of a cube?
24. What is transformation?
25. Explain the OpenGL functions used for translation, rotation and scaling?
26. What is the order of transformation?
27. State the difference between modelview and projection?
28. What is Homogeneous-coordinate representation?
29. Define the rotation matrix and object matrix.
30. Explain the procedure to obtain the resultant matrix using rotation matrix and object
matrix.
31. What is the principle of Cohen-Sutherland Algorithm?
32. State the advantages and disadvantages of Cohen-Sutherland Algorithm?
33. What is an outcode?
34. What is Synthetic Camera Model?
35. What are the Camera Specifications?
36. Explain the cases of outcodes in Cohen-Sutherland algorithm.
37. Explain the cohen-sutherland line clipping algorithm
38. Mention the difference between Liang-Barsky and Cohen-Sutherland line clipping
algorithm.
39. Explain about gluLookAt(...), glFrustum(...), gluPerspective?
40. Explain the different types of projections?
41. Explain Z-buffer algorithm?
42. What is antialiasing?

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 54


Computer Graphics Laboratory with Mini Project 17CSL68

43. What is Center Of Projection(COP), Direction Of Projection(DOP)?


44. What is midpoint circle drawing algorithm
45. How do you get the equation d+=2x+3, d+=2(x-y)+5
46. What is gluOrtho2D function
47. Explain plot pixel function
48. Why do we use GLFlush function in Display
49. Explain Specular, Diffuse and Translucent surfaces.
50. What is ambient light?
51. What is umbra, penumbra?
52. Explain Phong lighting model.
53. Explain glLightfv(...), glMaterialfv(...).
54. What is glutSolidCube function ? what are its Parameters
55. What are the parameters to glScale function
56. Explain Push & Pop matrix Functions
57. What is Materialfv function & its Parameters
58. Explain GLULookAt Function
59. Explain the keyboard and mouse events used in the program?
60. What is Hidden surface Removal? How do you achieve this in OpenGL?
61. What are the functions for creating Menus in OpenGL?
62. Explain about fonts in GLUT?
63. Explain about glutPostRedisplay()?
64. Explain how the cube is constructed
65. Explain rotate function
66. What is GLFrustum function what are its Parameters
67. What is viewport
68. What is glutKeyboard Function what are its Parameters
69. Explain scanline filling algorithm?
70. What is AspectRatio,Viewport?
71. How do you use timer?
72. What are the different frames in OpenGL?
73. What is fragment processing?
74. Explain Polygon Filling algorithm
75. What is slope
76. How the edges of polygon are detected
77. Why you use GL_PROJECTION in MatrixMode Function
78. What is dx & dy
79. What is maxx & maxy
80. What is glutPostRedisplay
81. Why do we use glutMainLoop function
82. What do you mean by GL_LINE_LOOP in GL_Begin function
83. Define Computer Graphics.
84. Explain any 3 uses of computer graphics applications.
85. What are the advantages of DDA algorithm?
86. What are the disadvantages of DDA algorithm?
87. Define Scan-line Polygon fill algorithm.
88. What are Inside-Outside tests?

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 55


Computer Graphics Laboratory with Mini Project 17CSL68

89. Define Boundary-Fill algorithm.


90. Define Flood-Fill algorithm.
91. Define attribute parameter. Give examples.
92. What is a line width? What is the command used to draw the thickness of lines.
93. What are the three types of thick lines? Define.
94. What are the attribute commands for a line color?
95. What is color table? List the color codes.
96. What is a marker symbol and where it is used?
97. Discuss about inquiry functions.
98. Define translation and translation vector.
99. Define window and view port.
100. Define viewing transformation.
101. Give the equation for window to viewport transformation.
102. Define view up vector.
103. What is meant by clipping? Where it happens?
104. What is point clipping and what are its inequalities?
105. What is line clipping and what are their parametric representations?
106. How is translation applied?
107. What is referred to as rotation?
108. Write down the rotation equation and rotation matrix.
109. Write the matrix representation for scaling, translation and rotation.
110. Draw the block diagram for 2D viewing transformation pipeline.
111. Mention the equation for homogeneous transformation.
112. What is known as composition of matrix?
113. Write the composition transformation matrix for scaling, translation and Rotation.
114. Discuss about the general pivot point rotation?
115. Discuss about the general fixed point scaling.
116. Explain window, view port and window - to - view port transformation
117. Mention the three raster functions available in graphics packages.
118. What is known as region codes?
119. Why Cohen Sutherland line clipping is popular?
120. Mention the point clipping condition for the liang-barsky line clipping.
121. What is called as an exterior clipping?
122. How is the region code bit values determined?
123. Why liang-barsky line clipping is more efficient than Cohen Sutherland line
Clipping?
124. Differentiate uniform and differential scaling
125. Explain soft fill procedures.
126. Explain the three primary color used in graphics
127. Explain in detail about color and grey scale levels?
128. Explain color and grey scale levels.
129. Explain the area fill attributes and character attributes.
130. Explain character attributes in detail.
131. Briefly discuss about basic transformations.
132. Explain matrix representations.
133. Discuss about composite transformations.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 56


Computer Graphics Laboratory with Mini Project 17CSL68

134. Explain about reflection and shear.


135. Explain the following transformation with the matrix representations.
Give suitable diagram for illustration translation .ii scaling.iii rotation.
136. How the rotation of an object about the pivot point is performed?
137. How window-to-viewport coordinate transformation happens.
138. Explain clipping with its operation in detail.
139. Explain Cohen- Sutherland line clipping.
140. Discuss the logical classifications of input devices.
141. Explain the details of 2d viewing transformation pipeline.
142. Explain point, line, curve, text, exterior clipping?
143. Discuss the properties of light.
144. Define chromaticity, complementary colors, color gamut and primary colors.
145. What is color model?
146. Define hue, saturation and value.
147. Explain XYZ color model.
148. Explain RGB color model.
149. Explain YIQ color model.
150. Explain CMY color model.
151. Explain HSV color model.
152. Give the procedure to convert HSV & RGB color model.
153. What is the use of chromaticity diagram?
154. What is illumination model?
155. What are the basic illumination models?
156. What is called as lightness?
157. Explain the conversion of CMY to RGB representation.
158. What is animation?
159. Define Morphing.
160. What are the steps involved in designing an animation sequence?
161. How to draw dots using OPENGL?
162. How to draw lines using OPENGL?
163. How to draw convex polygons using OPENGL?
164. What is the command used in OPENGL to clear the screen?
165. What are the various OPENGL data types?

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 57


Computer Graphics Laboratory with Mini Project 17CSL68

Viva questions and answers


1. What is Computer Graphics?
Answer: Computer graphics are graphics created using computers and, more generally,
the representation and manipulation of image data by a computer.

2. What is OpenGL?
Answer: OpenGL is the most extensively documented 3D graphics API (Application Pro-
gram Interface) to date. It is used to create Graphics.

3. What is GLUT?
Answer: The OpenGL Utility Toolkit (GLUT) is a library of utilities for OpenGL programs,
which primarily perform system-level I/O with the host operating system.

4. What are the applications of Computer Graphics?


Answer: Gaming Industry, Animation Industry and Medical Image Processing Industries.
The sum total of these industries is a Multi Billion Dollar Market. Jobs will continue to
increase in this arena in the future.

5. Explain in breif 3D Sierpinski gasket?


Answer: The Sierpinski triangle (also with the original orthography Sierpinski), also
called the Sierpinski gasket or the Sierpinski Sieve, is a fractal named after the Polish
mathemati- cian Waclaw Sierpinski who described it in 1915. Originally constructed as a
curve, this is one of the basic examples of self-similar sets, i.e. it is a mathematically
generated pattern that can be reproducible at any magni_cation or reduction.

6. What is Liang-Barsky line clipping algorithm?


Answer: In computer graphics, the Liang-Barsky algorithm is a line clipping algorithm.
The Liang-Barsky algorithm uses the parametric equation of a line and inequalities
describing the range of the clipping box to determine the intersections between the line
and the clipping box. With these intersections it knows which portion of the line should
be drawn.

7. Explain in brief Cohen-Sutherland line-clipping algorithm?


Answer: The Cohen-Sutherland line clipping algorithm quickly detects and dispenses
with two common and trivial cases. To clip a line, we need to consider only its
endpoints. If both endpoints of a line lie inside the window, the entire line lies inside the
window. It is trivially accepted and needs no clipping. On the other hand, if both
endpoints of a line lie entirely to one side of the window, the line must lie entirely outside
of the window. It istrivially rejected and needs to be neither clipped nor displayed.

8. Explain in brief scan-line area filling algorithm?


Answer: The scanline fill algorithm is an ingenious way of filling in irregular polygons.
The algorithm begins with a set of points. Each point is connected to the next, and the
line between them is considered to be an edge of the polygon. The points of each edge
are adjusted to ensure that the point with the smaller y value appears first. Next, a data

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 58


Computer Graphics Laboratory with Mini Project 17CSL68

structure is created that contains a list of edges that begin on each scanline of the
image. The program progresses from the first scanline upward. For each line, any pixels
that contain an intersection between this scanline and an edge of the polygon are filled
in. Then, the algorithm progresses along the scanline, turning on when it reaches a
polygon pixel and turning o_ when it reaches another one, all the way across the
scanline.

9. Explain Midpoint Line algorithm


Answer: The Midpoint line algorithm is an algorithm which determines which points in an
n-dimensional raster should be plotted in order to form a close approximation to a
straight line between two given points. It is commonly used to draw lines on a computer
screen, as it uses only integer addition, subtraction and bit shifting, all of which are very
cheap operations in standard computer architectures.

10. What is a Pixel?


Answer: In digital imaging, a pixel (or picture element) is a single point in a raster image.
The Pixel is the smallest addressable screen element; it is the smallest unit of picture
which can be controlled. Each Pixel has its address. The address of Pixels corresponds
to its coordinate. Pixels are normally arranged in a 2-dimensional grid, and are often
represented using dots or squares.

11. What is Graphical User Interface?


Answer: A graphical user interface (GUI) is a type of user interface item that allows
people to interact with programs in more ways than typing such as computers; hand-
held devices such as MP3 Players, Portable Media Players or Gaming devices;
household appliances and office equipment with images rather than text commands.

12. What is the general form of an OpenGL program?


Answer: There are no hard and fast rules. The following pseudocode is generally
recognized as good OpenGL form.

program_entrypoint
{
// Determine which depth or pixel format should be used.
// Create a window with the desired format.
// Create a rendering context and make it current with the window.
// Set up initial OpenGL state.
// Set up callback routines for window resize and window refresh.
}
handle_resize
{
glViewport(...);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set projection transform with glOrtho, glFrustum, gluOrtho2D, gluPerspective, etc.
}

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 59


Computer Graphics Laboratory with Mini Project 17CSL68

handle_refresh
{
glClear(...);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Set view transform with gluLookAt or equivalent
// For each object (i) in the scene that needs to be rendered:
// Push relevant stacks, e.g., glPushMatrix, glPushAttrib.
// Set OpenGL state speci_c to object (i).
// Set model transform for object (i) using glTranslatef, glScalef, glRotatef, and/or equiv-
alent.
// Issue rendering commands for object (i).
// Pop relevant stacks, (e.g., glPopMatrix, glPopAttrib.)
// End for loop.
// Swap bu_ers.
}

13. What support for OpenGL does Open,Net,FreeBSD or Linux provide?


Answer: The X Windows implementation, XFree86 4.0, includes support for OpenGL
using Mesa or the OpenGL Sample Implementation. XFree86 is released under the
XFree86 license. http://www.xfree86.org/

14. What is the AUX library?


Answer: The AUX library was developed by SGI early in OpenGL's life to ease creation
of small OpenGL demonstration programs. It's currently neither supported nor
maintained. Developing OpenGL programs using AUX is strongly discouraged. Use the
GLUT in- stead. It's more _exible and powerful and is available on a wide range of
platforms. Very important: Don't use AUX. Use GLUT instead.

15. How does the camera work in OpenGL?


Answer: As far as OpenGL is concerned, there is no camera. More speci_cally, the
camera is always located at the eye space coordinate (0., 0., 0.). To give the
appearance of moving the camera, your OpenGL application must move the scene with
the inverse of the camera transformation.

16. How do I implement a zoom operation?


Answer: A simple method for zooming is to use a uniform scale on the ModelView
matrix. However, this often results in clipping by the zNear and zFar clipping planes if
the model is scaled too large. A better method is to restrict the width and height of the
view volume in the Projection matrix.

17. What are OpenGL coordinate units?


Answer: Depending on the contents of your geometry database, it may be convenient
for your application to treat one OpenGL coordinate unit as being equal to one
millimeter or one parsec or anything in between (or larger or smaller). OpenGL also lets
you specify your geometry with coordinates of differing values. For example, you may

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 60


Computer Graphics Laboratory with Mini Project 17CSL68

find it convenient to model an airplane's controls in centimeters, its fuselage in meters,


and a world to fly around in kilometers. OpenGL's ModelView matrix can then scale
these different coordinate systems into the same eye coordinate space. It's the
application's responsibility to ensure that the Projection and ModelView matrices are
constructed to provide an image that keeps the viewer at an appropriate distance, with
an appropriate field of view, and keeps the zNear and zFar clipping planes at an
appropriate range. An application that displays molecules in micron scale, for example,
would probably not want to place the viewer at a distance of 10 feet with a 60 degree
field of view

18. What is Microsoft Visual Studio?


Answer: Microsoft Visual Studio is an integrated development environment (IDE) for
developing windows applications. It is the most popular IDE for developing windows
applications or windows based software.

19. What does the .gl or .GL _le format have to do with OpenGL?
Answer: .gl _les have nothing to do with OpenGL, but are sometimes confused with it.
.gl is a file format for images, which has no relationship to OpenGL.

20. Who needs to license OpenGL? Who doesn't? Is OpenGL free software?
Answer: Companies which will be creating or selling binaries of the OpenGL library will
need to license OpenGL. Typical examples of licensees include hardware vendors,
such as Digital Equipment, and IBM who would distribute OpenGL with the system
software on their workstations or PCs. Also, some software vendors, such as Portable
Graphics and Template Graphics, have a business in creating and distributing versions
of OpenGL, and they need to license OpenGL. Applications developers do NOT need to
license OpenGL. If a developer wants to use OpenGL that developer needs to obtain
copies of a linkable OpenGL library for a particular machine. Those OpenGL libraries
may be bundled in with the development and/or run-time options or may be purchased
from a third-party software vendor, without licensing the source code or use of the
OpenGLtrademark.

21. How do we make shadows in OpenGL?


Answer: There are no individual routines to control neither shadows nor an OpenGL
state for shadows. However, code can be written to render shadows.

22. What is the use of Glutinit?


Answer:
void glutInit(int *argcp, char **argv);
glutInit will initialize the GLUT library and negotiate a session with the window system.
During this process, glutInit may cause the termination of the GLUT program with an
error message to the user if GLUT cannot be properly initialized.

23. Describe the usage of glutInitWindowSize and glutInitWindowPosition?


Answer: void glutInitWindowSize(int width, int height);
void glutInitWindowPosition(int x, int y);

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 61


Computer Graphics Laboratory with Mini Project 17CSL68

Windows created by glutCreateWindow will be requested to be created with the current


initial window position and size. The intent of the initial window position and size values
is to provide a suggestion to the window system for a window's initial size and position.
The window system is not obligated to use this information. Therefore, GLUT programs
should not assume the window was created at the speci_ed size or position. A GLUT
program should use the window's reshape callback to determine the true size of the
window.

24. Describe the usage of glutMainLoop?


Answer: void glutMainLoop(void);
glutMainLoop enters the GLUT event processing loop. This routine should be called at
most once in a GLUT program. Once called, this routine will never return. It will call as
necessary any callbacks that have been registered.

Prepared By: Shatananda Bhat P, Asst. Professor, Department of CS & E, CEC | 62

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy