Showing posts with label cg source code. Show all posts
Showing posts with label cg source code. Show all posts

Monday, 28 March 2016

Aquarium

Aquarium


Description:
The Program demonstrate a simple illustration of how an Aquarium looks like, with option of providing foods, assembling the fishes as well as the poison food to decrease the population of fish inside. It is little bit complex project and may appear blur in some of the screen or even not fit. Change according to Screen resolution is required.

Usages: Left click and choose the options.

Food: Supply the different colored food.

Play: To resume play.

Assemble: To check the assembly of fish.

Poison Food: Poison food to make fish dies.

Exit: Quit from the program.

Screen Shot :





Download Program Source Code here
Download Report here

Brick Breaker - A Game

Brick Breaker - A Game

This is another of my game which is very primitive and unfinished. Anyone interested to develop the game further is welcome.

Here is how the UI looks like...


As you can see after running the code the game is partially complete and there is no end. If you want to show this as your computer graphics project you are free but you need to complete it.
This is a list of problems that need to be overcome.


  1. The bullets seem to pass through the bricks and the brick vanishes a little late. 
  2.  There are ten bullets used here and they are recycled. That is a bullet which passes through or which blasts a brick, its position is reinitialized to the muzzle of the shooter from where it is shot again. The problem is two bullets have a tendency to be shot together or close to each other. This looks so much uncool. We would want distance between bullets to be equal. 
  3. Even if a single brick comes near to the shooter region the game should end. I have deliberately left it unfinished. If you can write code to finish the game then it is a great thing. You can claim a little credit for having worked on this project. If you are able to solve the problems i mentioned earlier then you are a pro. If you manage to do so and if you are magnanimous enough you can get me the code and i will share it with everyone after giving you the credit.
Download Program Source Code here
Download Report here

PacMan Game

PacMan Game

The two games are not my own creation and these are regularly submitted by students of every batch. I have modified some portions of the code where, in leaping lizards i have made it to rotate and in the pacman version that i got initially the pacman was not turning at turns.

In pac-man(in light blue/aqua) even though it looks like a 2D image it is actually a 3D pacman. It is drawn as a sphere and even the ghosts are spheres.

Thebugs in the code include the following:
  1. in level 2 if pacman dies the lives counter starts decrementing and never stops. It shoulddecrement by one and a new game started.
  2. Pacman should look like eating the food. This may be difficult with a 3D sphere so modifying the pac-man drawing code to 2D image of a circle may help.
  3.  In power mode when the pacman can eat a ghost it does not kill it but just passes through 
Here is how pac-man looks like...






Download Program Source Code here
Download Report here

Racer Game

Racer Game

In this project the cars are moving as earlier in the old racer car project posted before. Only extra thing that is added is that the black meter line on the road is made to translate down so that it gives an impression that the cars are moving.

Here are a few snaps:



The problem with this project is that after some points a few cars block the road and player compulsorily loses.



Download Program Source Code here


Download Report here

Racing Car

Racing Car

As the name suggests this racing car is going on a racing track which glows...



Will turn out as an excellent professional though i would like to advise him to slow down his typing speed while writing programs and devote more time to designing and analysis. I mean with paper and pencil before actually typing code. I know no programmer gets it right the first time but trial and error is not the right way to code.

Needless to say i hate spaghetti code. Code which is not indented properly, Code which does not have comments. Code which has lots of debugging statements and code with lots of lines commented. Code with warnings while compiling and which runs anyway. Last thing that a programmer does after writing code which does the job is to beautify the code. Optimize the code. Make it look better. Write as many comments. Even if it’s just a hundred or two hundred line program it should be "delivered" properly even if its going to be an open source software.(NOTE: I FOLLOW NONE OF THE ABOVE. WHAT IS WRITTEN HERE IS CHARACTERISTICS OF AN IDEAL PROGRAMMER)

Screen Shots:




Download Program Source Code here
Download Report here

Sinking Ship

Sinking Ship



Namratha and sweekruthi worked on this existing project. The modification done to the sinking ship project that has been done is the ice berg becomes two pieces... both the pieces move down and sink.

Here are the snaps:

Moving....




Collison... 




Pieces of iceberg and ship sinking....




Download Program Source Code here
Download Report here


Simple Light

Simple Light

Description: 

Example program illustrating a simple use of lighting.  Creates six spheres of different fully saturated colors. Adds a white light that slow rotates around the spheres.


USAGE:

Press "r" key to toggle (off and on) running the animation
Press "s" key to single-step animation.
The up arrow key and down array key control the time step used in the animation rate.
This will speed up or slow down the rate at which the light revolves around the spheres.
Press ESCAPE to exit.
This lighting model is build on the basis of phong model,Which supports three types of light material interactions namely Specular, ambient, diffuse. The ambient source color represents the interaction of a light source with surface whereas the specular source color is designed to produce the desired color of a specular highlights.

Lighting model is built by summing the contributions for all the light sources at each point we wish to light. For each light source, have to compute the amount of light reflected for each of the nine terms in the illumination array. The contribution can be computed for each color source by adding the ambient, diffuse, specular components.

There are four vector parameters that can set, the position of light source and amount of ambient, diffuse, specular Light associated with the source.  Both lighting should be enabled and particular source. When small amount of white light is needed, even when all light sources are turned off or disabled  following code can be used.


Glfloat global_ambient[]={0.1,0.1,0.1,0.1};

glLightModelfv(GL_LIGHT_MODEL_AMBIENT,global_ambient);


Future scope

  1. It is the basic model of Simple Move Light.
  2.  It will be used in the fields of animation. 
  3. In future this program can be improved by using of new opengl functions.
Screen Shot:



Download Program Source Code here
Download Report here

Solar System


 Solar System

Description: Program to demonstrate how to use a local  coordinate method to position parts of a  model in relation to other model parts. Draws a simple solar system, with a sun, planet and  a moon. Based on sample code from the OpenGL programming guide by Woo, Neider, Davis.  Addison-Wesley.

Software accompanying the book:  3D Computer Graphics: A Mathematical Introduction with OpenGL, by S. Buss, Cambridge University Press, 2003.

                                               

USAGE: Press "r" key to toggle (off and on) running the animation.

Press "s" key to single-step animation.

The up arrow key and down array key control the time step used in the animation rate.

Each key  press multiplies or divides the times by a factor of two (2).

Press ESCAPE to exit.


Screen Shot: 



Download Program Source Code here
Download Report here



Spot Light Swing

Spot Light Swing

Description:  

A simple light show where different lights are falling on different area and creating a very good scene the Spot Light Swing. This Program demos the use of swing and the different lightning functions. As Shown in the image this is light show coming from a point source. Just like in disco where lights fall from a point on the floor, also the changes the color.



Usages: 

Just run the program and you will get the light show running, lights with different colors on the floor. No interaction, if any one add in it please comment the code you added. 



Future Improvement in the Projects:


  1. Add front end where all details are there and then enter this light show.
  2. In light show there should be start and stop options.
  3. Along with start and stop there should be option of increasing and decreasing the light.
  4. Basic color red, blue, green is used, other colors should also be included.


Screen Shot:


Download Program Source Code here
Download Report here

Taj Mahal


Taj Mahal

Taj Mahal is the symbol of love. It  is a white Marble mausoleum located in Agra, INDIA. It was built by Mughal emperor Shah Jahan in memory of his third wife, Mumtaz Mahal. For more info read Wikipedia 

Here, we are going to develop basic structure of Taj Mahal in computer graphics. In this tutorial I will tell how to make Taj like structure using the OpenGL. We will develop simple structure, not exactly same as it looks in real but some what idealistic. This project is mainly mean for the VTU Computer Graphics mini-projects.




Taj Mahal is basically a structure with many minars and gumbazz. We will use the simple objects like spheres and cubes to build these units. First for the main part we use box or a large cube and then point small sphere over them. Thereafter, we place a small cubical structure with very low height, a egg like sphere is also placed over it. Similarly,we going to place four long minars over each four corners.

We are also developing the wired framed structure of the Taj as well. In the wired framed Taj, the large cube block will go transparent and the two tombs will be place in the middle with small cubes.



Download Program Source Code here
Download Report here


Traffic Signal


Traffic Signal
Descriptions : As we know, the traffic signals direct the flow of traffic with the exemption of signals with turning arrows which should be compulsory in accord with each other.Traffic signals helps us to drive our vehicles in a safer manner lowering the risk of accidents, if properly followed.

In this Project simulation, we are implementing  Traffic Signal. We have three lights in the signal Red , Green and Orange. Each light have some meaning . Red means stop , Green means go, Orange means ready to go.
Same method we implemented in our project which used in real life .We have used this traffic signal in a cross road to avoid misshapening. When there is green signal it means vehicle can move or run on the road but if this green signal turnoff  and the red signal is turn on then its indicate the driver to stop his vehicle and same time signal allows some other side vehicle to cross the road. But if the vehicle is in the middle of cross or vehicle have cross the signal then there is no meaning of red light for the driver. When we press button R then red light will glow and all vehicles are stop n when we press Y button then  yellow light will glow and all vehicles ready to go .When  we press button G  green light will glow and then vehicle start  moving.  
Screenshot:






Download Program Source Code here
Download Report here

Simulation of Train

Simulation of Train

Kudos to Kusuma V(1CE11CS025)... This is her original creation. I have been trying to get adsense work on this blog but they have issues with plagiarized content. So am trying to post original projects of our students.

There are three trains which move on a track. The wheels rotate and they all move one after the other out of view.

Screenshots:



Download Program Source Code here
Download Report here

Racing Car in a Race Track

Racing Car in a Race Track


Computer Graphics has grown into a very important topic in the branch of Computer Science. This is due to an effective and rapid communication formed between man and the machine. Human eye can absorb the information in a displayed diagram or perspective diagram much faster than it can scan a page or a table of contents.



     This project demonstrates the creation of a moving racing car along with a circular race track and scenery.The user is also given the option to see the car from different views.OpenGL is used to make this possible by virtue of its various functionalities.


    We make use of simple geometric figures like triangle, circle and polygons to construct the parts of racing car and the track .Cones, spheres and cylinders are used to generate the trees. We also include lighting and material properties.

     The code implemented makes use of various OpenGL functions for translation, rotation and keyboard callback function, built-in functions for solids and many more.

      The concepts of computer graphics stand a backbone to achieve the aforementioned idea. Primitive drawing, event driven interactions and basic animation have been the important concepts brought out by this application.

      The report is chalked out into sections describing the basic requirements superseded by the briefing on functions used. Following this, the detailed description of how the implementation is done effectively using these functions and C language is presented. The source code is provided along with necessary comments to enhance readability of code. The screenshots have been provided for amelioration of our little effort. The conclusion and the future enhancements proposed conclude the report.The maximum efforts are been made to ensure that the view is aesthetically pleasing and eye-catching.

Screenshots:


Back side view:


 Front View:


Helicopter View: 


Side View: 




Download Program Source Code here
Download Full Project Report here

Worms

Worms
This project is created by using OpenGL interface along with GLUT (OpenGL library Toolkit), using the platform eclipse as the compiling tool. 
The title of the project is WORMS. This project has been developed in simple and lucid  manner, so that future there can be changes made in the code. 
[WORMS :- Are the only life which came upon the earth first. They are found beneath (underground) the base i.e., inside the mud.]
We begin our project with compilation steps. By running the program. We see in the output screen the worms moving in many directions. i.e., they move every where in screen, not in one straight line.
Next we see these worms in different color. Some with green, blue, red, etc,.
Next we see providing a simple menu option with sub option upon right click of mouse to display.
  1. WORMS
  2.  DRAWING MODE
  3. QUIT 
With first option we see the WORMS getting together and start moving in much direction.With second option drawing mode we have sub option: 
  • FILLED
  • UNFILLED

      In filled the worms are filled completely with colors, and with unfilled its just vice-versa of filled i.e., they are not completely filled with color.

      When the mouse is clicked at any position in output screen, these worms gather to that point and then separated in different direction.
            At last option we have QUIT. To exit from the output.
Screenshots:

Mouse clicked point

Shows right click of mouse button the option occurs with worms drawing mode and quit
 Worms are filled with color

Worms are meeting at one pint when they mouse is clicked at particular point

Worms separating from point where they met
 Worms with unfilled option
Download Program Source Code here
Download Full Project Report here

Friday, 12 June 2015

Worms

Worms
This project is created by using OpenGL interface along with GLUT (OpenGL library Toolkit), using the platform eclipse as the compiling tool. 
The title of the project is WORMS. This project has been developed in simple and lucid  manner, so that future there can be changes made in the code. 
[WORMS :- Are the only life which came upon the earth first. They are found beneath (underground) the base i.e., inside the mud.]
We begin our project with compilation steps. By running the program. We see in the output screen the worms moving in many directions. i.e., they move every where in screen, not in one straight line.
Next we see these worms in different color. Some with green, blue, red, etc,.
Next we see providing a simple menu option with sub option upon right click of mouse to display.
  1. WORMS
  2.  DRAWING MODE
  3. QUIT 
With first option we see the WORMS getting together and start moving in much direction.With second option drawing mode we have sub option: 
  • FILLED
  • UNFILLED

      In filled the worms are filled completely with colors, and with unfilled its just vice-versa of filled i.e., they are not completely filled with color.

      When the mouse is clicked at any position in output screen, these worms gather to that point and then separated in different direction.
            At last option we have QUIT. To exit from the output.
Screenshots:

Mouse clicked point

Shows right click of mouse button the option occurs with worms drawing mode and quit
 Worms are filled with color

Worms are meeting at one pint when they mouse is clicked at particular point

Worms separating from point where they met
 Worms with unfilled option
Download Program Source Code here
Download Full Project Report here