Updated date:

Computer Graphics Lab Programs and mini Projects for VTU 6th sem

What is Computer graphics?

The Computer Graphics is one of the most effective and commonly used methods to communicate the processed information to the user. It displays the information in the form of graphics objects such as pictures, charts, graphs and diagram instead of simple text.

In the field of computer graphics objects are presented as a collection of discrete picture elements called pixels,which is smallest element addressed.

Although early application in engineering & science had to rely on expensive & cumbersome equipments, advances in computer technology have made interactive computer graphics a practical tool. Today we find Computer Graphics in a diverse area such as science, engineering, medicine, business, industry, government, art, entertainment, education and training. Now you are able to answer about computer graphics as generalized tool for drawing and creating pictures and simulate the real world situations within a small computer window.

AREAS OF APPLICATION OF COMPUTER GRAPHICS

  • User interfaces
  • Plotting of graphs and charts
  • Office automation and Desktop publishing
  • Computer aided Drafting and designs
  • Process control
  • Cartography
computer-graphics-lab-programs-mini-projects-vtu-6th-sem

Introduction to VTU Computer Graphics Subject

Computer Graphics is one of the major facets in the computer industry. With the help of graphics package many applications like gaming, paint brush, entertainment, movies and other innovative applications can be run.

Keeping the fact in mind Visvesvaraya Technological University (VTU) has one subject called Computer graphics in Computer science and engineering stream. It is one of the thrilling and interesting topic covered in 6th sem. While it is compulsory for the Computer science and engineering stream, it can be opt by Information science and engineering students as an optional subject.

Beside the subject as a topic in the stream syllabus, there is a practical Lab also which is named as Computer Graphics and Visualization lab. Here Students have to implement the theory they learned from the main subject in to a practical reality. There are 10 lab programs which need to cover in the entire semester. Beside this they need to have one mini project in OpenGL Computer graphics.

The motive is to learn how to code for the graphics. How an object like triangles, rectangles, circles and other polygons can be coded to show as graphics in computer. With these primitive objects large objects are also formed like houses, teapot and cubes. It is important to learn all the things in lab so that those learning get curved into the mini projects.

The main Computer graphics subject is of 100 marks in external and 25 marks for internal test. While the Lab Cum Project has been granted 25 marks for internal and 50 marks for External examinations.

The CG Lab Programs Syllabus

Before we go for the Lab programs we first need to know which programs are listed in the VTU CG 6th sem Computer graphics and Visualization Lab Syllabus. There are 10 programs mentioned for Cg lab beside the mini projects. Most of people like to have them in the vtu 6th sem cg lab manual.

In VTU Computer graphics subject the lab programs that are mentioned is listed below.

  1. Program to recursively subdivide a tetrahedron to form 3D Sierpinski gasket. The number of recursive steps is to be specified by the user.
  2. Program to implement Liang-Barsky line clipping algorithm.
  3. Program to draw a color cube and spin it using OpenGL transformation matrices
  4. Program to create a house like figure and rotate about a given fixed point using openGL functions.
  5. Cohen-Sutherland Line Clipping Algorithm with Window to viewport Mapping using OpenGL API.
  6. Program to create a cylinder and a parallelepiped by extruding a circle and a quadrilateral respectively. Allow the user to specify the circle and the quadrilateral.
  7. Program using openGL functions to draw a simple shaded scene consisting of a teapot on a table. Define suitably the positions and properties of the light source along with the properties of the surfaces of the solid object used in the scene.
  8. Program to draw a color cube and allow the user to move the camera to experiment with perspective viewing .Use openGL functions.
  9. Program to fill any given polygon using scan-line area filling algorithm. (Use appropriate data structures).
  10. Program to display a set of values {fij} as a rectangular mesh.


computer-graphics-lab-programs-mini-projects-vtu-6th-sem

Introduction to OpenGL Programming

OpenGL is (Open Graphics Library) is a cross-language, multi-platform application programming interface (API) for rendering 2D and 3D vector graphics. The OpenGL was developed by Silicon Graphics Inc. (SGI). The current Stable release of OpenGL is OpenGL 4.5 released on 11 August 2014.

OpenGL is a software interface to graphics hardware. This interface consists of about 150 distinct commands that you use to specify the objects and operations needed to produce interactive three-dimensional applications. OpenGL is designed as a streamlined, hardware-independent interface to be implemented on many different hardware platforms.

Most of our application will be designed to access OpenGL directly through functions in three libraries. Functions in the main GL (or OpenGL in windows) library have names that begin with the letters gl and are stored in a library usually referred to as GL (or OpenGL in windows). The second is the OpenGL Utility Library (GLU). This library uses only GL functions but contains code for creating common objects and simplifying viewing. All functions in GLU can be created from the core GL library but application programmers prefer not to write the code repeatedly. The GLU library is available in all OpenGL implementations; functions in the GLU library begin with letters glu.

How to Run your first OpenGL Computer graphics Program

To run Hello world Program in OpenGL Computer graphics for Windows you need to have Microsoft Visual Studio. Download it from Microsoft Site and install on your Desktop or PC. After Installation get the glut files and all done. See step by step procedure -

1. First go to http://www.visualstudio.com/en-US/products/visual-studio-express-vs , Download the Visual C++ Express. Install the software on your computer.

2. Now time is to get freeglut libraries. Visit http://www.transmissionzero.co.uk/software/freeglut-devel/ to download the freeglut 2.8.0 MSVC Package and extract it.

3. Copy the necessary file to the required folders. Copy paste the header files in include folder of your version Visual studio at C:\Program Files (choose visual studio folder) , similarly the lib files to Lib folder and dll files to Bin folder.

4. Open the Visual Studio create a new Project and start coding.

Cylinder and Parallelopiped Program Output

Cylinder and Parallelopiped CG Lab Output

Cylinder and Parallelopiped CG Lab Output

Computer graphics lab Programs for VTU 6th sem

Below I am listing few of the Programs with their Objectives and in the ends you find the links to download full source code free.

Program 1 : 3D Sierpinski Gasket CG OpenGL Program

Objective: Students will able to create to draw 3D Sierpinski gasket using openGL functions.

Program 6 : OpenGL Program for Cylinder and Parallelepiped

Objective: The main object of this program is that the students will able to learn how to create a cylinder and a parallelepiped using OpenGL functions.

You can Download the Computer graphics lab Programs for VTU 6th sem computer science from Google drive link.

There all the program is listed along with the output. Just download and copy paste the project in your Visual Studio for Windows program or save them as separate c files in Linux ubuntu system.


Code for 3D Sierpinski gasket using openGL functions

#include <GL/glut.h> //glut library
#include <stdlib.h> //for exit
#include <stdio.h> //input from user

typedef   float  point[3];

point v[]={ {0.0,0.0,1.0},
      {0.0,0.943,-0.33},
      {-0.816,-0.471,-0.33},
      {0.816,-0.471,0.33}};

int n;//defines the no of step to be obtain from user

void triangle(point a,point b,point c)
{
	glBegin(GL_POLYGON);
	glNormal3fv(a);
	glVertex3fv(a);
	glVertex3fv(b);
	glVertex3fv(c);
	glEnd();
}

void divide_tri(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;

			for(j=0;j<3;j++)
			v2[j]=(a[j]+c[j])/2;

		for(j=0;j<3;j++)
			v3[j]=(b[j]+c[j])/2;

		divide_tri(a,v1,v2,m-1);

		divide_tri(c,v2,v3,m-1);

		divide_tri(b,v3,v1,m-1);
	}
else   
         	triangle(a,b,c);
}



void tetrahedron(int m)
{
	glColor3f(1.0,0.0,0.0);
	divide_tri(v[0],v[1],v[2],m);
	glColor3f(0.0,1.0,0.0);
	divide_tri(v[3],v[2],v[1],m);
	glColor3f(0.0,0.0,1.0);
	divide_tri(v[0],v[3],v[1],m);
	glColor3f(0.0,0.0,0.0);
	divide_tri(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 recursive steps\n”);
        scanf(“%d”, &n);
	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
	glutInitWindowSize(500,500); //windows size
	glutCreateWindow("3D Sierpinski gasket");
	glutReshapeFunc(myReshape);
	glutDisplayFunc(display);
	glEnable(GL_DEPTH_TEST);
	glClearColor(1.0,1.0,1.0,1.0);
	glutMainLoop();
}

Output for 3D Sierpinski gasket

3D Sierpinski gasket output with different steps entered by user

3D Sierpinski gasket output with different steps entered by user

Why Learn Computer graphics

Learning Computer graphics is important for the career of the Computer science students. Most of CSE students either choose their profession as system engineer or programmer or a developer. Either be a system Programmer or game developer use of graphics necessary for you survive in this vast IT industry. Thus Learning your curves on Computer graphics is must.

Where You find Computer graphics -

  • Android apps
  • iOS App
  • Windows Phone apps
  • Xbox apps
  • Windows Desktop apps
  • Games Development

Learn OpenGL Computer graphics

Computer graphics mini Project Demo Video

OpenGL Computer graphics Mini Projects

There are many topics on which you can develop you computer graphics mini projects. Some of them are -

  1. Life Cycle of Butterfly
  2. Fountains
  3. Water Cycle
  4. Any Chemical reaction
  5. Games like ludo, snakes xzenia, snake and ladders etc.
  6. Racing games like car racing
  7. Demo the Algorithm like sorting, merging, searching etc.
  8. Simulation like of nuclear power plant

And many more.......

One of the topic which mentioned above, you see the demo in the video embedded here.

The whole purpose of this is to make student learn and apply them in simple and useful demonstration. It helps them for developing the interest in the graphics field of computers. In future they may become game developer or film maker which helps them then, with these concepts.

OpenGL Projects HawkEye Output

computer-graphics-lab-programs-mini-projects-vtu-6th-sem

Favourite Subject for VTU 6th Sem

Resources

Comments

prathima on May 07, 2019:

sir can i plzz get a code for simulation of bubble sort using open gl in computer graphics

Rajeev Kumar (author) on November 17, 2016:

these are studne projects not commercial games

Rajeev Kumar (author) on November 17, 2016:

These projects are listed on opengl projects find it out there and download the source and also share our website

Rajeev Kumar (author) on November 17, 2016:

It is not that easy and urgency can't be act on.....

Rajeev Kumar (author) on November 17, 2016:

visit our website and you will find so many projects..............

anu on February 02, 2016:

can i please get the source code to simulate clash of kings game

Axanti on December 04, 2015:

sir please can i get open gl source code to develop a simulation for traffic signal and the cars should move in all the four direction

ambika on May 10, 2015:

sir please can i get opengl source code for angry bird game its urgent sir please...

nishma on April 21, 2015:

sir can i get open gl source code for life cycle of butterfly

Rajeev Kumar (author) on March 08, 2015:

PKreturns great name for you how you get this?

I think we have large no of projects hope you enjoy visiting them

Pradeep PK from Bangalore, India on March 08, 2015:

There are very few projects there

Rajeev Kumar (author) on March 05, 2015:

@Kishan thanks try to find it at http://www.openglprojects.in/ OpenGL Computer graphics Blog

Thanks

Rajeev Kumar (author) on September 04, 2014:

Hi! Rajesh

Would Write another hub for what you mentioned. Thanks for the suggestion.

Rajesh on September 03, 2014:

This is quite interesting!

Could you write more about opengl es in Anroid and iOS programming?

Rajeev Kumar (author) on August 28, 2014:

Hi! Chandra

My Name is rajeev.

To point - I would like to improve with suggestion from like of you.

Chandra on August 28, 2014:

Hey rajjev your artilce is fine but you need to show more beautiful code structure write more about opengl in your post.

Rajeev Kumar (author) on August 28, 2014:

Hi! Rajesh Thanks for your comment!

Rajesh on August 28, 2014:

Nice Article