Archive Pages Design$type=blogging

How to add front screen in your OpenGL Project

In VTU lab for Computer Graphics, developing a mini-project is part of it. While developing CG mini...

In VTU lab for Computer Graphics, developing a mini-project is part of it. While developing CG mini-projects using OpenGL, there is need to present the project well. One must add front screen to the project which show the names of college, projects, guides and the project developers. It is good to have front screen as it provides introduction of the project.

There are many ways of adding front screen to the project. Here I explains, the basic way of adding front screen to the mini-project. Typically what looks in the picture below. Let's get started.

front screen in OpenGL mini-project



Simple keyboard interaction to start with

First set a variable, initialized it to zero.        
int flag=0;


Write a function called frontscreen, which contains all the details which you want to display.

void frontscreen(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,1);
drawstring(20.0,90.0,0.0,"NAME OF THE COLLEGE ");
glColor3f(0.7,0,1);
drawstring(21,82,0.0,"DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING");
glColor3f(1,0.5,0);
drawstring(38,70,0.0,"A MINI PROJECT ON");
glColor3f(1,0,0);
drawstring(40,60,0.0,"PROJECT TITLE");
glColor3f(1,0.5,0);
drawstring(20,50,0.0,"BY:");
glColor3f(0.5,0,0.5);
drawstring(10,40,0.0,"NAME FIRST           (USN)");
drawstring(10,34,0.0,"NAME SECOND         (USN)");
glColor3f(1,0.5,0);
drawstring(68,50,0.0,"GUIDES:");
glColor3f(0.5,0.2,0.2);
drawstring(63,40,0.0,"GUIDE NAME FIRST");
drawstring(63,34,0.0,"GUIDE NAME SECOND");
glColor3f(1,0.1,1);
drawstring(32,10,0.0,"PRESS ENTER TO START");
glFlush();
}

Next is to write the code for the keyboard interaction which let user start the program. As in our case we have taken 'enter' key as our starting point. So when user press the 'enter' program leave the front page and start executing the main part of the project. Different keys may be assign for this job. Let's code a function called
myKeyboardFunc. This function will set flag value to 1  if the assigned key is press, thus making the way for displaying the main ideology of project.


void myKeyboardFunc( unsigned char key, int x, int y )

{
switch(key)
{
case 13:if(flag==0) //Ascii of 'enter' key is 13
flag=1;
break;
       }
    mydisplay();
}

The
mydisplay() function is called which will display the program execution on the screen. In this function we check the flag value and display according to that. If flag is not set to 1 (mean user has not pressed the key assign to start), front screen will display and if it set to 1 (mean user had started the program by pressing assigned key), the project will execute for what it is mean for. The code is simple as given below.

void mydisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
if(flag==0)
frontscreen ();
if(flag==1)
display();
}

The display() called above should contained and properly designed (coded) according to the requirement of the project. Functions need to be adjusted as one develop the project, so precaution must be taken and adjustment can be made to codes to make sure project work properly.

Note :  drawstring in above will display the strings so proper function need to be call for this. Also make sure  you must call 'glutDisplayFunc(mydisplay)' and 'glutKeyboardFunc(myKeyboardFunc)', in main function. Also do not confuse with display and mydisplay in main.

COMMENTS

Name

3D Bi-Cycle 3D Game 3D Laptop 3D Objects 3D Projects 3D Zoo Algorithm Android Aquarium Bellman-Ford Algorithm Block Breaker Blockshooting Bucket Sort C# Chess Clock Code Blocks Colors Complex Project Complex Projects Crab Pong Cross Zero DSAV Escapa First Come First Serve Fluids Font Demo Games Gear Motion GlutDino Glutplane Graphics Editor iOS iPhone Java Java OpenGL Graphics Programming Light Torus Linked List Ludo Board Game Mancala board games Memory blocks game Memory Game Menu Mickey Mouse Minesweeper Miniature Steam Engine moth Motion Blur MoveLight moving car Moving Ship Multiplex Networking Based Project Nuclear Power Plant Olympic opengl c++ examples OpenGL ES OpenGL Tutorial Origami OS Based Projects Paint Paper Folding Particles Drop Path Finding ping pong Pong Game Project Report Projects Report Puzzles qix like Random Flowing lines Rigid Body Rings Robot sample c++ opengl code Screen Saver Screen Saver Ship Shadow Cube Shadowfun Ship Iceberg Simple Drawing Simple Haloed Lined Wireframe Simple Move Light Simple Project Simulation SNAKE XENZIA GAME Solar system Sorting Sphere Spot Light Swing Stars Taj Mahal The Edge Game Tic Tac Toe Tower of Hanoi Traffic Signal Transformation Triangular Animation Tutorial water ripple effects Whirlpool
false
ltr
item
OpenGL Projects: How to add front screen in your OpenGL Project
How to add front screen in your OpenGL Project
http://1.bp.blogspot.com/--M2R5f7MOPQ/T2sWyguL1UI/AAAAAAAABGo/F8J7hJ7Myvs/s400/front+screen+mini+project+opengl.JPG
http://1.bp.blogspot.com/--M2R5f7MOPQ/T2sWyguL1UI/AAAAAAAABGo/F8J7hJ7Myvs/s72-c/front+screen+mini+project+opengl.JPG
OpenGL Projects
http://www.openglprojects.in/2012/03/how-to-add-front-screen-in-your-opengl.html
http://www.openglprojects.in/
http://www.openglprojects.in/
http://www.openglprojects.in/2012/03/how-to-add-front-screen-in-your-opengl.html
true
2020194800836807725
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago