2D Rotation Computer Graphics Project in OpenGL Source Code – 18CSL67

 

2D Rotation Computer Graphics Project in OpenGL Source Code – 18CSL67

Here you can download the source code of the 2D Rotation Computer Graphics Project in OpenGL – 18CSL67 for academic mini-project.

Project Description of 2D Rotation CGV Mini-Project

The project idea is to display different 2D objects. This graphics package is based on the OpenGL library functions. The programming language used here is C using OpenGL libraries.

Video Demonstration of 2D Rotation CGV Mini-Project

Main theme of the project is:

In this project, we designed Triangle, Quad which is placed in a specific position in a plane, with specific colors, and for those objects we implement rotation.

The operation implemented are:

  • Coloring.
  • Rotation.
  • Size.
  • It also illustrates how to add menus.
  • glBegin() and glEnd() functions can be used to draw the 2D objects.
  • Myreshape function is called whenever the user reshapes the openGL window.

Whenever we do right click on the window, options are available and the option we select the object will appear on the window.

Module Description of 2D Rotation CGV Mini-Project

Main( ) : In main function first we call glutInit( ) to initialise GLUT. We can set window properties properties by using APIs such as: glutInitWindowSize( ), glutInitWindowPosition( ) and glutInitDisplayMode().

In main Display( ), myReshape( ), myIdleFunc( ), mymenu( ), myMouse( ) these functions are called.

Display( ) : In this display function we clear the window background. Next, we set the window background color. In this function we used glRotatef( ) to rotate the object. This function used to display the graphics objects. In this we called drawPrim() and Swapbuffers( ) functions.

MyReshape( ) : This function is called whenever the user reshapes the openGL window. The glut sends the new window dimensions(x,y).

myIdleFunc( ) : This function increments the rotation variable within glutMainLoop( ).

myMenu( ) : Here we are created  a menu by using glutCreateMenu( ) function. Menu options  included here are Quit,Objects,Color.

exit( ) : exit( ) function is used to exit from window.

Sub1: In this sub1 menu the objects are included. The objects are Triangle and Quad.

Sub2: In this sub2 menu the size can be included. There are two options for size increment size and decrement size.

Sub3: In this sub3 menu we included the speed of rotation. The speed of rotation can be increased or decreased.

Sub4: In this sub4 menu we included color options. The colors are red, green and blue.

Sub5: In this sub5 menu we included the vertex color option. Vertex color means for each vertex we are assigning different colors.

DrawPrim( ) : This function is used to create geometric objects. The objects are Triangle and Quad.

The Triangle can be drawn using glBegin( ) and glEnd( ). The Quad is also can be drawn by using glBegin( ) and glEnd( ).

The objects are filled objects so we can draw these objects by calling GL_POLYGON within in glBegin( ). In between glBegin( ) and glEnd( ) we had included vertices.

Flow Chart of 2D Rotation CGV Mini-Project

2D Rotation Computer Graphics Project in OpenGL Source Code – 18CSL67

Screenshots of 2D Rotation CGV Mini-Project

Initial Position with all options

Initial Position with all options

After Rotation with options

After Rotation with options

Subscribe to our YouTube channel for more videos and like the Facebook page for regular updates.

Leave a Comment

Your email address will not be published. Required fields are marked *

Welcome to VTUPulse.com


Computer Graphics and Image Processing Mini Projects -> Click Here

Download Final Year Project -> Click Here

This will close in 12 seconds