ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

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

Updated on February 27, 2015

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

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.


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

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

Favourite Subject for VTU 6th Sem

Which is your favourite topic you like most in your 6th Sem Syllabus?

See results

Comments

    0 of 8192 characters used
    Post Comment

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      23 months ago

      these are studne projects not commercial games

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      23 months ago

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

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      23 months ago

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

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      23 months ago

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

    • profile image

      anu 

      2 years ago

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

    • profile image

      Axanti 

      2 years ago

      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

    • profile image

      ambika 

      3 years ago

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

    • profile image

      nishma 

      3 years ago

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

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      3 years ago

      PKreturns great name for you how you get this?

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

    • PKreturns profile image

      Pradeep PK 

      3 years ago from Bangalore, India

      There are very few projects there

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      3 years ago

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

      Thanks

    • profile image

      kishan 

      3 years ago

      i want source code of water cycle computer graphics project

      plz mail in kumarkishan553@gmail.com

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      4 years ago

      Hi! Rajesh

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

    • profile image

      Rajesh 

      4 years ago

      This is quite interesting!

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

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      4 years ago

      Hi! Chandra

      My Name is rajeev.

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

    • profile image

      Chandra 

      4 years ago

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

    • Bluelotusrajeev profile imageAUTHOR

      Rajeev Kumar 

      4 years ago

      Hi! Rajesh Thanks for your comment!

    • profile image

      Rajesh 

      4 years ago

      Nice Article

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)