Multiplex is a place where you have multi screen to show various movies in different languages. Today we are going to have Multiplex - C++ graphics program. We have seen so many graphic programs in our website but this one something different from others. This program have so many features which we are going to explain below. This C++ graphics program has been developed using opengl graphics library in microsoft visual c++. You can use the same source code with some modification in the program like in linux or code blocks IDE.
Two Displays
This Multiplex - C++ graphics program divided into mainly to two different displays. First screen shows the entrance of multiples. In this display the multiplex theatre building with hoarding is shown in output of the program. In addition to the building a person, a car, trees and road is also displayed. To go inside the multiplex or enter the new display of execution left mouse button can be used.
In the second the ticket counter along with different screen of the theater is displayed. There is also a popcorn counter. This program is very interactive and takes input from user to display. As you enter the multiplex theater by pressing left mouse button you will have choice to choose you movies. Here to simplify things the movies or screen are named on the language- Hindi, English, Tamil and Kannada. Each screen has been give a specific key so when user press that key the person will enter the theater of assigned key. More user interactions are shown in below section of reading.
Coding of C++/C graphics program
As already described above code of this c++ program used opengl graphics library. The code has been executed in windows platform using MS Visual studio. You can port this in different platform using some modification. This program is written in c++ opengl, hence it utilized the power of opengl primitive functions.
In this program a method name "box" is created. The snippet of same is shown below. These lines of code are very simple and easy to understand.
void box(int a,int b,int c,int d,int e,int f,int g,int h)
{
glBegin(GL_POLYGON);
glVertex2f(a,b);
glVertex2f(c,d);
glVertex2f(e,f);
glVertex2f(g,h);
glEnd();
}
If you know opengl then you might be aware of GL_POLYGON, it creates polygon of desired sides. The a,b,c,d,e,f,g,h are variable of coordinate can be used while calling the method. Each object can be individually coded but using this method, you can save time as well reduce the length of program. This method saved many lines of codes. In similar ways other objects like building, cars, trees etc has been coded.
User interaction
There are two way interaction in this program. This C++ graphics program used both Mouse and Keyboard to take input from the user. Function for each keys and mouse is described below.
Mouse Interaction
Left Mouse Button - Press to go and view inside the multiplex theater.
Right Mouse Button - Press to exit from the multiplex anytime.
Keyboard Interaction
'm' to get inside theatre and go to ticket counter
'h' to go to hindi movie
'k' to go to kannada movie
't' to go to tamil movie
'e' to go to english movie
'p' to go to popcorn counter
'h' to go to hindi movie
'k' to go to kannada movie
't' to go to tamil movie
'e' to go to english movie
'p' to go to popcorn counter
Future Enhancement
This program can be improved by converting this in 3D version. Also we can add many people instead of just a single person. Motion of person moving can also be added in future. Addition of sounds will also make this program fare improvement.
VIDEO DEMO
VIDEO DEMO
Source Code
To get the source code of this multiplex C++ graphics program shoot an email to openglprojects@gmail.com.
Kindly Share your view about the program via comments, or you can email us as well.
No comments:
Post a Comment