   help : Graphics Project in openGL
  For our graphics project we developed a small helicopter game using glut and openGL with visual Studio6.0. but when the game window is minimized and then maximized the helicopter is not displaying.is thereany way to avoid thisordisable minimize and maximize option of the window???here is the code============================================================================/* * Developed By: *Ananth S [AM107CP104] * Vineeth G K[AM107CP166] *Vivek Bhaskaran[AM107CP170] * *Created on:24-04-2009 */#include<glut.h>#include <ctime>#include <cstdlib>#include<dos.h>#include<stdio.h>#include<stdlib.h>#include<conio.h>#include<windows.h>float prx,pry;float bspd=0.02;float b1x=50.0,b1y=0;//block 1float hm=0.0;//copter movingfloat b2x=100,b2y=100;int i=0,sci=1;float scf=1;char scs[20],slevel[20];int level=1,lflag=1,wflag=1;void init(void){srand(time(0));b1y=(rand()%45)+10;glClearColor (0.0, 0.0, 0.0, 0.0);glShadeModel (GL_SMOOTH);glLoadIdentity ();glOrtho(0.0, 100.0, 0.0, 100.0,-1.0  , .0);}void drawcopter(){glColor3f(0.7,1.0,1.0);glRectf(10,49.8,19.8,44.8);//bodyglRectf(2,46,10,48);//tailglRectf(2,46,4,51);//tail upglRectf(14,49.8,15.8,52.2);//propeller standglRectf(7,53.6,22.8,52.2);//propeller*/}void renderBitmapString(float x,float y,float z,void *font,char *string){char *c;glRasterPos3f(x, y,z);for (c=string; *c != '\0'; c++){glutBitmapCharacter(font, *c);}}void display(void){glClear(GL_COLOR_BUFFER_BIT);//GameOver Checkingif((i==730||i==-700) //top and bottom checking||( ((int)b1x==10||(int)b1x==7||(int)b1x==4||(int)b1x==1)   &&(int)b1y<53+(int)hm&&(int)b1y+35>53+(int)hm) // propeller front checking||( ((int)b1x==9||(int)b1x==3||(int)b1x==6) &&(int)b1y<45+(int)hm&&(int)b1y+35>45+(int)hm)//lower body checking||( ((int)b1x==0) && (int)b1y<46+(int)hm&&(int)b1y+35>46+(int)hm)// lower tail checking  ){glColor3f(0.8,0.8,1.0);glRectf(0.0,0.0,100.0,100.0);glColor3f(0.0,0.0,0.0);renderBitmapString(30,70,0,GLUT_BITMAP_TIMES_ROMAN_24,"GAME OVER!!!");renderBitmapString(35,58,0,GLUT_BITMAP_TIMES_ROMAN_24,"Distance:");renderBitmapString(55,58,0,GLUT_BITMAP_TIMES_ROMAN_24,scs);renderBitmapString(30,45,0,GLUT_BITMAP_TIMES_ROMAN_24,"Developed By:");renderBitmapString(22,33,0,GLUT_BITMAP_TIMES_ROMAN_24,"Vineeth, Ananth, Vivek");renderBitmapString(31,22,0,GLUT_BITMAP_TIMES_ROMAN_24,"S4 BSc CS");glutSwapBuffers();glFlush();printf("GAME OVER\nClose the console window to exit...\n");getch();exit(0);}else if(wflag==1)//Welcome Screen{wflag=0;glColor3f(0.3,0.7,0.2);glRectf(0.0,0.0,100.0,10.0);//ceilglRectf(0.0,100.0,100.0,90.0);//floorglColor3f(1.0,1.0,0.0);renderBitmapString(0,92,0,GLUT_BITMAP_8_BY_13,"Copyright:");renderBitmapString(17.5,92,0,GLUT_BITMAP_9_BY_15,"Ananth,Vineeth,Vivek");glColor3f(1.0,0.0,0.0);renderBitmapString(35,48,0,GLUT_BITMAP_TIMES_ROMAN_24,"CLICK TO START");renderBitmapString(22,40,0,GLUT_BITMAP_9_BY_15,"CLICK AND HOLD LEFT MOUSE BUTTON TO GO UP");renderBitmapString(42,35,0,GLUT_BITMAP_9_BY_15,"RELEASE TO GO DOWN");drawcopter();glutSwapBuffers();glFlush();}else{if(sci%50==0&&lflag==1){lflag=0;level++;bspd+=0.01;}else if(sci%50!=0&&lflag!=1){lflag=1;}glPushMatrix();glColor3f(0.3,0.7,0.2);glRectf(0.0,0.0,100.0,10.0);//ceilglRectf(0.0,100.0,100.0,90.0);//floorglColor3f(1.0,1.0,0.0);//scorerenderBitmapString(1,3,0,GLUT_BITMAP_TIMES_ROMAN_24,"Distance:");//glColor3f(0.7,0.7,0.7);itoa(level,slevel,10);//levelrenderBitmapString(80,3,0,GLUT_BITMAP_TIMES_ROMAN_24,"Level:");renderBitmapString(93,3,0,GLUT_BITMAP_TIMES_ROMAN_24,slevel);scf+=0.005;//SCOREsci=(int)scf;itoa(sci,scs,10);renderBitmapString(20,3,0,GLUT_BITMAP_TIMES_ROMAN_24,scs);glTranslatef(0.0,hm,0.0);drawcopter();//code for helicopterif(b1x<-10){b1x=50;b1y=(rand()%25)+20;}elseb1x-=bspd;//printf("\n%5.1f",b1y);//printingglTranslatef(b1x,-hm,0.0);glColor3f(1.0,0.0,0.0);glRectf(b1x,b1y,b1x+5,b1y+35);//block 1glPopMatrix();glutSwapBuffers();glFlush();}}void moveHeliU(void){hm+=0.05;i++;glutPostRedisplay();}void moveHeliD(){hm-=0.05;i--;glutPostRedisplay();}void mouse(int button, int state, int x, int y){switch (button){case GLUT_LEFT_BUTTON:if (state == GLUT_DOWN)glutIdleFunc(moveHeliU);else if (state == GLUT_UP)glutIdleFunc(moveHeliD);break;default:break;}}int main(int argc, char** argv){glutInit(&argc, argv);glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);glutInitWindowSize (500, 400);glutInitWindowPosition (200,300);glutCreateWindow ("*CopterSTAR* 2.0");init();glutDisplayFunc(display);glutMouseFunc(mouse);glutMainLoop();return 0;}
  Your need a reshape function in your program. Example : GLvoid Reshape(int width, int height){glViewport(0,0,width,height);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(45.0,(float)width/height,0.5f,200.0f);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}and in your main do this :int main(int argc, char** argv){   ...    ... ...    glutReshapeFunc(Reshape);   ...   ...    glutMainLoop();   return 0;};  i dont know how to add reshape function.and also i am using ortho projection.i tried a reshape function but i didnt get the desired result.can anybody give me the reshape function for my code.   