Search Projects

Tuesday, May 24, 2011

SNAKE XENZIA GAME

Description: Program to demonstrate the most Popular game on the Nokia Phones called Snake Xenzia. A snake feeding will allow user experience as which they do in the phones.


USAGES: There are a number of keyboard commands that control the animation.  They must be typed into the graphics window, and are listed below

   CONTROLLING RESOLUTION OF THE TORUS MESH

     Press "W" to increase the number wraps.
     Press "w" to decrease the number wraps.
     Press "N" to increase the number of segments per wrap.
     Press "n" to decrease the number of segments per wrap.
     Press "q" to toggle between quadrangles and triangles.
 
   CONTROLLING THE ANIMATION:

     Press the "a" key to toggle the animation off and on.
     Press the "s" key to perform a single step of the animation.
     The left and right arrow keys controls the rate of rotation around the y-axis.
     The up and down arrow keys increase and decrease the rate of rotation around the x-axis.
     In order to reverse rotational direction you must zero or reset the torus ("0" or "r").
     Press the "r" key to reset the torus back to initial position, with no rotation.
     Press "0" (zero) to zero the rotation rates.

   CONTROLLING LIGHTS:


     Press '1' or '2' to toggle the first or second light off and on.
     Press 'f' to toggle between flat and smooth shading.
     Press 'l' to toggle local modes on and off (local viewer and positional light,or non-local viewer and directional light).

   COMMANDS SHOWING OPENGL FEATURES:


     Pressing "p" toggles between wireframe and polygon mode.
     Pressing "f" key toggles between flat and smooth shading.


Project Code: Download
Header File: Download

Monday, May 23, 2011

Motion Blur

Motion Blur


Description: The illustrate the Creation of a single component texture map with use of accumulation buffer for motion blur. A very simple Project to show off.

Usages: Right click and choose the two of the available options. Normal option return the image to Normal and the Motion Blur option cause to show the motion blur.

Project Code: Download

Project in OpenGL demonstrating working of Miniature Steam Engine

Miniature Steam Engine


Description: The program simulate the working of Miniature Steam Engine with wire frame and 3D shaped views. The animation shows the movement as how the steam engine work. It is quite complex program make use of texture and simple check pattern. It has a wide range of user interaction as well.

Usages: Click either button and choose to animate and select the views and exit.


      Shaded : For Shading the object
     Animation  : To start Animating the work.
     Texture   Texture mapping
     Transparency  Make use of  Transparency in objects. 
     Right Light  : To view as light falling on right side.
     Left Light  :   To view as light falling on left side.
     Speed UP   :  Speed up the motion by 1 
     Slow Down  : Speed Down the motion by 1 



Keyboard functions:


a: Animate manually in  anti-clockwise direction
z: Animate manually in  clockwise direction
s: Toggle b/w wire frame and shaped views.
+: Increase the speed by 1
-: Decrease the speed by 1
2: Moving the Whole engine down
4: Moving the Whole engine left
6: Moving the Whole engine right
8: Moving the Whole engine up


Project Code: Download



Notes:  Transparence doesn't quite work. The color of the underlying object doesn't show through.
    Also only the front side of the transparent objects are transparent.

OpenGL project showing Aquarium




Description: The Program demonstrate a simple illustration of how a 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

       
Project Code: Download 

Friday, May 20, 2011

[PPT(output)] Simple wire framed figure with motion (demo use of Stencil)

Simple wire framed figure with motion (demo use of Stencil)


Description: 
The main intent of this program is to demo the stencil plane functionality, hence the rendering is kept  simple (wire frame).

Usese:
Right click to choose the motion and the Stencil on/off.

The Project Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
static int stencilOn = 1;
/* function declarations */
void drawScene(void), setMatrix(void), animation(void), resize(int w, int h),
  keyboard(unsigned char c, int x, int y), menu(int choice), drawWireframe(int face),
  drawFilled(int face);
/* global variables */
float ax, ay, az;       /* angles for animation */
/* coords of a cube */
static GLfloat cube[8][3] =
{0.0, 0.0, 0.0,
  1.0, 0.0, 0.0,
  1.0, 0.0, 1.0,
  0.0, 0.0, 1.0,
  1.0, 1.0, 0.0,
  1.0, 1.0, 1.0,
  0.0, 1.0, 1.0,
  0.0, 1.0, 0.0};
static int faceIndex[6][4] =
{0, 1, 2, 3,
  1, 4, 5, 2,
  4, 7, 6, 5,
  7, 0, 3, 6,
  3, 2, 5, 6,
  7, 4, 1, 0};
int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitWindowSize(400, 400);
  glutInitDisplayMode(GLUT_RGB | GLUT_STENCIL | GLUT_DOUBLE | GLUT_DEPTH);
  glutCreateWindow("Stenciled hidden surface removal");
  ax = 10.0;
  ay = -10.0;
  az = 0.0;
  glutDisplayFunc(drawScene);
  glutReshapeFunc(resize);
  glutCreateMenu(menu);
  glutAddMenuEntry("Motion", 3);
  glutAddMenuEntry("Stencil on", 1);
  glutAddMenuEntry("Stencil off", 2);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
  glutKeyboardFunc(keyboard);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
void drawWireframe(int face)
{
  int i;
  glBegin(GL_LINE_LOOP);
  for (i = 0; i < 4; i++)
    glVertex3fv((GLfloat *) cube[faceIndex[face][i]]);
  glEnd();
}

void drawFilled(int face)
{
  int i;
  glBegin(GL_POLYGON);
  for (i = 0; i < 4; i++)
    glVertex3fv((GLfloat *) cube[faceIndex[face][i]]);
  glEnd();
}
void drawScene(void)
{
  int i;
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glPushMatrix();
  glRotatef(ax, 1.0, 0.0, 0.0);
  glRotatef(-ay, 0.0, 1.0, 0.0);
/* all the good stuff follows */
  if (stencilOn) {
    glEnable(GL_STENCIL_TEST);
    glClear(GL_STENCIL_BUFFER_BIT);
    glStencilMask(1);
    glStencilFunc(GL_ALWAYS, 0, 1);
    glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
  }
  glColor3f(1.0, 1.0, 0.0);
  for (i = 0; i < 6; i++) {
    drawWireframe(i);
    if (stencilOn) {
      glStencilFunc(GL_EQUAL, 0, 1);
      glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    }
    glColor3f(0.0, 0.0, 0.0);
    drawFilled(i);

    glColor3f(1.0, 1.0, 0.0);
    if (stencilOn) {
      glStencilFunc(GL_ALWAYS, 0, 1);
      glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
    }
    glColor3f(1.0, 1.0, 0.0);
    drawWireframe(i);
  }
  glPopMatrix();
  if (stencilOn)
    glDisable(GL_STENCIL_TEST);
  /* end of good stuff */
glutSwapBuffers();
}
void setMatrix(void)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}
int count = 0;
void animation(void)
{
  /* animate the cone */
  ax += 5.0;
  ay -= 2.0;
  az += 5.0;
  if (ax >= 360)
    ax = 0.0;
  if (ay <= -360)
    ay = 0.0;
  if (az >= 360)
    az = 0.0;
  glutPostRedisplay();
  count++;
  if (count >= 60)
    glutIdleFunc(NULL);
}
void menu(int choice)
{
  switch (choice) {
  case 3:
    count = 0;
    glutIdleFunc(animation);
    break;
  case 2:
    stencilOn = 0;
    glutSetWindowTitle("Stencil Disabled");
    glutPostRedisplay();
    break;
  case 1:
    stencilOn = 1;
    glutSetWindowTitle("Stencil Enabled");
    glutPostRedisplay();
    break;
  }
}
/* ARGSUSED1 */
void keyboard(unsigned char c, int x, int y)
{
  switch (c) {
  case 27:
    exit(0);
    break;
  default:
    break;
  }
}
void resize(int w, int h)
{
  glViewport(0, 0, w, h);
  setMatrix();
}

Images for Output of Simple Haloed Lined Wireframe






Simple Haloed Lined Wireframe

Haloed Lined Wireframe

Description: The project will demonstrate a simple  Haloed Lined Wireframe with option of toggle and color filling. A Pyramidal octagonal shaped  is made along with a torus tube. The use is allow to toggle between the shapes as well as from the 3D filled object to haloed object.


USAGE: Right click and choose the suitable options

           Filled Object : Fills the wired object with color.
           Wireframe: To see wireframe view.
           Haloed Wireframe: Halo the object wireframe.
           Pgon Offset Haloed Wireframe: Offset the halo.
           Backface Haloed Wireframe: Back face the haloed wireframe.
          Toggle Object: Toggle between the two objects.

          Press Escape to exit.


Project Code: Download

Ludo Board Game output images







Ludo Board Game



Ludo board game


Description:  A Project which will let you play the one of the oldest Board Game of Ludo. It is two player game and not the four player. More description are available in the code itself.


USAGES:  Right click at the start up page to see different options(also work during game play)


About the project: Instruction and info regard to the project
Rules of the Game: Stating the rule governing the game.
Game Mode or Restart: To start the game at beginning or to restart a new game in middle of on going game.
Quit: To exit from the game.


After the game load you will be asked to press enter to start the game. In the game click on the board to spin the dice. To move the turn click on the mover.


Project Code: Download

Tuesday, May 17, 2011

Olympic



Description: A simple program demonstrate the display of the Olympic logo. The program has make use of Lightning and material Functions.


USAGE: Just for fun no interaction required, may add motion to the circles at their position only.


Project Code: Download

Gear Motion Video Demo

Gear Motion Output Images





OpenGL project on Mechanical Gear Motion


Gear Motion

Description: This project point out the use of maths functions and the material functions as well as translation function. A mechanical gear model is made to move in random direction. Two of the Gears are perpendicular to each other and moving. The teeth is curved in both the gear with a very keen look to make visible like real.


USAGE: No Interaction, you may add codes to change the speed of the motion as well as to stop moving the gears. The gear starts running as program start. If any change is done please tell the code in the coment box.


Project Code: Download

Tuesday, May 10, 2011

Demo for Output of Triangular Animation

Triangular Animation


Description: Three triangles making an animated motion. Three triangle in different colors make a shape which move nicely.


Usages: 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 sqrt(2).
            Press ESCAPE to exit.


Project Code: Download

Spot Light Swing Output Demo image and video



Monday, May 9, 2011

Mini-Project on 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.

Project Code: Spot Light Swing OpenGL Free Source Code Download

Sphere output snapshots

1

2

3

4

OpenGL mini-project on Sphere colouration







Description: The sphere with different colors and shapes and their selection in different menus. This program create two windows and each windows ahve different sub-menus.


USAGE: Left click and choose the sub-menus in both windows and then choose the option.


Project Code: Download

Sunday, May 8, 2011

Simple Move Light Images and Video demos

1

2

Computer Graphics Mini-Project Simple Move Light

SimpleLight


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
Ø  It is the basic model of Simple Move Light
Ø  It will be used in the fields of animation.

Ø  In future this program can be improved by using of new opengl functions.

Computer Graphics Mini-Project Free Source Code Download 

We are giving the Computer Graphics Mini-Project free source code download. To help other students we need your help as well. Kindly if you modify this projects or any other kindly post email or post the projects code to help future students.

Project Code: Download
Header File: Download



Solar system Demo Video

Solar system Demo images


1

2

3

4

Solar system Header file "Solar.h"

Solar.h
Copy code of and paste on notepad and named it Solar.h to be needed with Solar.c. Note without this file your project will not run properly. Copy it or download it by clicking on Download button or Solar.h(above)

Code:

void OpenGLInit(void);
static void Animate(void );
static void Key_r(void );
static void Key_s(void );
static void Key_up(void );
static void Key_down(void );
static void ResizeWindow(int w, int h);
static void KeyPressFunc( unsigned char Key, int x, int y );
static void SpecialKeyFunc( int Key, int x, int y );

Download

*Please don't change anything else you will have modify your both solar.c as well solar.h.

Solar System Mini-Project in OpenGL

OpenGL Projects is new initiative in the field of education.OpenGL Projects is one site that provides source code and materials for VTU 6th sem CSE students. Our first Program is - Solar System. Download source code of solar system in OpenGL and read the description below.

solar system

DescriptionProgram 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.


Project Code: Downloads *
* Also required the header file Download .h file