Trouble with rerendering????????

I solved my problem about the subwindow…but a new trouble has creeped in…
i want to have an interactive application, it works simply great for the first time… but gives a problem like “debug assertion failed”.
i am using glut on vc++6.0.
as was recommended i am posting my code as well
The include files in the code pertain to processing the textual input by the user and display the corresponding shape.
Why does it take only one input???
is there any way to put it into some kind of while-loop???
HELP.
/* Main Program*/
#include<stdio.h>
#include<conio.h>
#include"INITIAL.h"
#include"Recogniz.cpp"
#include<GL/glut.h>

class Object
{
virtual void draw(float quantifier)=0;
virtual void draw(int c,float quantifier,int fill)=0;
void erase()
{
//clrscr();
}
};

class Line
{
float side;/* length ie*/
float width;

public:

Line()
{
side=iLength;
width=iThick;
}

void draw(float quantifier,int c)
{

if(quantifier&gt;=2)
{	
	quantifier-=2;
    if(quantifier*width &gt; MAX*iThick)
    width=MAX*iThick;
    else
	if(quantifier*width &lt; MIN*iThick)
	width=MIN*iThick;
	else
	width=quantifier*width;
    glLineWidth(width);
}
else
{	
	if(quantifier*side &gt; MAX*iLength)
		side=MAX*iLength;
	else
	if(quantifier*side &lt; MIN*iLength)
	side=MIN*iLength;
	else
	side=quantifier*side;
}
/*Default Color*/
glColor3f(carr[c].r,carr[c].g,carr[c].b); 

/* function for LINE*/
glBegin(GL_LINES);
	glVertex2f(-side/2,-side/2);
	glVertex2f(side/2,side/2);
glEnd();

}

};

class Circle ublic Object
{
float radius;

public:

Circle()
{
radius=iRad;
}

void draw(float quantifier)
{
if(quantifierradius > MAXiRad)
radius=MAXiRad;
else
if(quantifier
radius < MINiRad)
radius=MIN
iRad;
else
radius=quantifier*radius;

//setcolor(color);
//circle(320,240,radius);

}

void draw(int c,float quantifier,int fill)
{
if(quantifierradius > MAXiRad)
radius=MAXiRad;
else
if(quantifier
radius < MINiRad)
radius=MIN
iRad;
else
radius=quantifier*radius;

if(fill==0)
{
//setcolor©;
//circle(320,240,radius);
}
else
{
// setfillstyle(1,color);
// fillellipse(320,240,radius,radius);
}
}
};

class Triangle : public Object
{
float side;
int color;

public:

Triangle()
{
side=iSide;
color=1;
}

void draw(float quantifier)
{
if(quantifierside > MAXiSide)
side=MAXiSide;
else
if(quantifier
side < MINiSide)
side=MIN
iSide;
else
side=quantifier*side;

/*Default Color*/

glColor3f(carr[1].r,carr[1].g,carr[1].b); 

/* function for triangle*/

glBegin(GL_LINE_LOOP);
	glVertex2f(-side,0.0);
	glVertex2f(0.0,side);
	glVertex2f(side,0.0);
glEnd();

}

void draw(int c,float quantifier,int fill)
{
if(quantifierside > MAXiSide)
side=MAXiSide;
else
if(quantifier
side < MINiSide)
side=MIN
iSide;
else
side=quantifier*side;

/* fuction for setting the color*/

glColor3f(carr[c].r,carr[c].g,carr[c].b);

/* function for triangle*/

if(fill==1)
{
 glBegin(GL_POLYGON);
	glVertex2f(-side,0.0);
	glVertex2f(0.0,side);
	glVertex2f(side,0.0);
 glEnd();
}

else
{
 glBegin(GL_LINE_LOOP);
	glVertex2f(-side,0.0);
	glVertex2f(0.0,side);
	glVertex2f(side,0.0);
 glEnd();
}

}
};

class Rectangle : public Object
{
float length;
float breadth;

public:

Rectangle()
{
length=2*iSide;
breadth=iSide;
}

void draw(float quantifier)
{
if(quantifierlength > MAXiSide)
{
length=MAXiSide;
breadth=length/2;
}
else
if(quantifier
breadth < MINiSide/2)
{
breadth=MIN
iSide/2;
length=2breadth;
}
else
{
length=quantifier
length;
breadth=length/2;
}

/*Default Color*/

glColor3f(carr[1].r,carr[1].g,carr[1].b); 

/* function for rectangle*/
glBegin(GL_LINE_LOOP);
	glVertex2f((-length/2),0.0);
	glVertex2f(length/2,0.0);
	glVertex2f(length/2,breadth);
	glVertex2f((-length/2),breadth);
glEnd();

}

void draw(int c,float quantifier,int fill)
{
if(quantifierlength > MAXiSide)
{
length=MAXiSide;
breadth=length/2;
}
else
if(quantifier
breadth < MINiSide/2)
{
breadth=MIN
iSide/2;
length=2breadth;
}
else
{
length=quantifier
length;
breadth=length/2;
}

/*function for setting the color*/

glColor3f(carr[c].r,carr[c].g,carr[c].b);

if(fill==1)
{
/* function for rectangle*/
  glBegin(GL_POLYGON);
	glVertex2f((-length/2),0.0);
	glVertex2f(length/2,0.0);
	glVertex2f(length/2,breadth);
	glVertex2f((-length/2),breadth);
  glEnd();
}

else
{
 glBegin(GL_LINE_LOOP);
	glVertex2f((-length/2),0.0);
	glVertex2f(length/2,0.0);
	glVertex2f(length/2,breadth);
	glVertex2f((-length/2),breadth);
 glEnd();
}

}
};

class Square ublic Object
{
float side;
float width;
public:

Square()
{
side=iSide;
width=iThick;
}

void draw(float quantifier)
{
if(quantifier>=2)
{
quantifier-=2;
if(quantifierwidth > MAXiThick)
width=MAXiThick;
else
if(quantifier
width < MINiThick)
width=MIN
iThick;
else
width=quantifierwidth;
glLineWidth(width);
}
else
{
if(quantifier
side > MAXiSide)
side=MAX
iSide;
else
if(quantifierside < MINiSide)
side=MINiSide;
else
side=quantifier
side;
}
/* Default Colour*/
glColor3f(carr[1].r,carr[1].g,carr[1].b);
/* function for square*/
glBegin(GL_LINE_LOOP);
glVertex2f((-side/2),0.0);
glVertex2f(side/2,0.0);
glVertex2f(side/2,side);
glVertex2f((-side/2),side);
glEnd();
}

void draw(int c,float quantifier,int fill)
{if(quantifier>=2)
{
quantifier-=2;
if(quantifierwidth > MAXiThick)
width=MAXiThick;
else
if(quantifier
width < MINiThick)
width=MIN
iThick;
else
width=quantifierwidth;
glLineWidth(width);
}
else
{
if(quantifier
side > MAXiSide)
side=MAX
iSide;
else
if(quantifierside < MINiSide)
side=MINiSide;
else
side=quantifier
side;
}
/* fuction for setting the color*/
glColor3f(carr[c].r,carr[c].g,carr[c].b);
if(fill==1)
{
/* function for square*/
glBegin(GL_POLYGON);
glVertex2f((-side/2),0.0);
glVertex2f(side/2,0.0);
glVertex2f(side/2,side);
glVertex2f((-side/2),side);
glEnd();
}
else
{
glBegin(GL_LINE_LOOP);
glVertex2f((-side/2),0.0);
glVertex2f(side/2,0.0);
glVertex2f(side/2,side);
glVertex2f((-side/2),side);
glEnd();
}

}

};

class Ellipse : public Object
{
float radius;
int color;

public:

Ellipse()
{
radius=iRad;
color=1;
}

void draw(float quantifier)
{
if(quantifierradius > MAXiRad)
radius=MAXiRad;
else
if(quantifier
radius < MINiRad)
radius=MIN
iRad;
else
radius=quantifier*radius;

//setcolor(color);
//ellipse(320,240,0,360,radius,radius/2);
}

void draw(int c,float quantifier,int fill)
{
if(quantifierradius > MAXiRad)
radius=MAXiRad;
else
if(quantifier
radius < MINiRad)
radius=MIN
iRad;
else
radius=quantifier*radius;

color=c;
// setfillstyle(1,color);
// fillellipse(320,240,radius,radius/2);
}

};

/* Creating Objects*/
Circle Cobj;
Triangle Tobj;
Rectangle Robj;
Square Sobj;
Ellipse Eobj;
Line Lobj;
float rx=-2.5,ry;

/* glut god!*/

void init(void)
{
glClearColor(1.0,1.0,1.0,1.0);
glShadeModel(GL_FLAT);
}
void init1(void)
{
glClearColor(0.5,0.5,0.5,1.0);
glShadeModel(GL_FLAT);
}

void resh(int w,int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,(GLdouble)w,0.0,(GLdouble)h,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glViewport(0,0,w,h);

}

void disp(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glColor3f(1.0,1.0,1.0);
gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(-2.5,2.5);
glVertex2f(2.5,2.5);
glVertex2f(2.5,2.25);
glVertex2f(-2.5,2.25);
glEnd();
//glRasterPos2i(rx,500);

//glFlush();
glutSwapBuffers();

}

void display(void)
{
float q;
int fill=0;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0.0,0.0);
glPushMatrix();
if(!na)
{
if(s1.q2q!=0)
{
if(s1.quantifier<2)
{
if(s1.quantifier<1)
q=s1.quantifier*(1-s1.q2q);
else
q=s1.quantifier*(1+s1.q2q);

	}
 else
 {
	 s1.quantifier-=2;
	 if(s1.quantifier&lt;1)
     q=s1.quantifier*(1-s1.q2q);
     else
     q=s1.quantifier*(1+s1.q2q);
     q+=2;   	 
 }

}
else
q=s1.quantifier;
if(s1.verb==‘p’)
fill=1;
else fill=0;
switch(s1.shape)
{
case ‘c’: if(s1.color==-1)
Cobj.draw(q);
else
Cobj.draw(s1.color,q,fill);
break;

  case 't': if(s1.color==-1)
	  Tobj.draw(q);
	else
	  Tobj.draw(s1.color,q,fill);
	break;

  case 'r': if(s1.color==-1)
	  Robj.draw(q);
	else
	  Robj.draw(s1.color,q,fill);
	break;

  case 's': if(s1.color==-1)
	  Sobj.draw(q);
	else
	  Sobj.draw(s1.color,q,fill);
	break;

  case 'i': if(s1.color==-1)
	  Eobj.draw(q);
	else
	  Eobj.draw(s1.color,q,fill);
	break;

  case 'l': if(s1.color==-1)
	  Lobj.draw(q,1);
	else
	  Lobj.draw(q,s1.color);
	break;

  /*case 'p': if(s1.color==-1)
	  Pobj.draw(q);
	else
	  Pobj.draw(s1.color,q,fill);
	break;
 */

}
}

glFlush();
glPopMatrix();
glutSwapBuffers();

}

void reshape(int w,int h)
{
glViewport(0,0,(GLsizei) w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0,(GLfloat)w/(GLfloat)h,1.0,20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
}

void keyboard(unsigned char k,int x,int y)
{
glColor3f(0.0,0.0,0.0);
glRasterPos2f(rx,2.27);
if(int(k)!=65)
{
cout<<char(k);
glutBitmapCharacter(GLUT_BITMAP_9_BY_15,k);
rx+=0.1;
glutSwapBuffers();
glutSwapBuffers();
}
else
recogniz();
//glutBitmapCharacter(GLUT_BITMAP_9_BY_15,‘O’);

//disp();

}

int main(int argc,char** argv)
{
int id,id1;

glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);

glutInitWindowSize(800,600);
glutInitWindowPosition(0,0);

id=glutCreateWindow("Shape/Colour Tutor");
init();
initColour();
glLineWidth(3);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
//recogniz();

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(800,600);
glutInitWindowPosition(0,400);
//id1=glutCreateSubWindow(id,0,400,800,600);
glutCreateWindow("Type");
//glutSetWindow(id1);
init1();
glutDisplayFunc(disp);
glutReshapeFunc(reshape); 
glutKeyboardFunc(keyboard);

glutMainLoop();

return 0;

}

Hi !

Your keyboard() callback function is called each time you press a key, but you cannot use swapbuffers in your function, you should use the refresh function instead, I think it is called glutRedisplay() or something like that, this will force an update of the window contents, just swapping buffers is not a good thing, and doing it twice in a row is even worth…

Hope that helps.
Mikael

I agree that two “swapBuffers” ahould not be put together… but if i donot have two swapbuffers the contents are not rendered at all…
I thought about the ReDisplay callback too… i hope that works…
Thanks
Richa

First you should have only one call to swapbuffers and it should be after you have drawn your complete scene.

I don’t think it is good to put drawing commands in your keyboard routine, instead use variables to control drawing changes in your display routine.

example of my display code:

void display(void)
{
// Let’s prepare our our screen to be drawn on.
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Let’s define our viewing area (camera)
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0, 10.0, 10.0, -10.0, -1.0, 30.0);
// Let’s tell openGL that we are ready to draw
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// here I use a variable called light_state to turn lighting on and off
if (light_state == 1)
{
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL); // Enable for lighing
}else
{
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL); // Disable for no lighing
}

glPushMatrix();// Draw small solid cube
glColor3f(0.0, 1.0, 1.0); // give it a color
glTranslatef( solid_cube_x, solid_cube_y, -20.0); //move it into our our view.
if (solid_cube_rotate == 1) solid_cube++;
if (solid_cube > 360) solid_cube = 0; // check for rotation pass 360, and reset if above.
glRotatef(360 - solid_cube, 0.0, 0.0, 1.0); // rotate on z-axis
glRotatef(solid_cube, 1.0, 0.0, 0.0);
glRotatef(solid_cube, 0.0, 1.0, 0.0);
glutSolidCube(2.0);
glPopMatrix();

glPushMatrix(); // Draw small solid cylinder.
glColor3f(1.0, 0.2, 1.0);
glTranslatef( solid_cone_x, solid_cone_y, -20.0);
if (solid_cone_rotate == 1) solid_cone++;
if (solid_cone > 360) solid_cone = 0;
glRotatef(solid_cone, 0.0, 0.0, 1.0);
glRotatef(360 - solid_cone, 1.0, 0.0, 0.0);
glRotatef(solid_cone, 0.0, 1.0, 0.0);
gluCylinder(Cylinder, 1, 1, 2, 16, 16);
if (cylinder_state == 1)
{
gluDisk(Disk, 0, 1, 16, 2); // Bottom end cap of cylinder
glTranslatef(0.0, 0.0, 2.0);// top end cap of cylinder
gluDisk(Disk, 0, 1, 16, 2);
}
glPopMatrix();

glPushMatrix(); // Draw large wire cube
glColor3f(1.0, 1.0, 1.0);
glTranslatef( 0.0, 0.0, -20.0);
if (wire_cube_rotate == 1) wire_cube++;
if (wire_cube > 360) wire_cube = 0;
glRotatef(wire_cube, 0.0, 0.0, 1.0);
glRotatef(wire_cube, 0.0, 1.0, 0.0);
glRotatef(360 - wire_cube, 0.0, 0.0, 1.0);
glutWireCube(10.0);
glPopMatrix();

glutSwapBuffers();
}

[QUOTE]Originally posted by Richa:
[b]I solved my problem about the subwindow…but a new trouble has creeped in…
i want to have an interactive application, it works simply great for the first time… but gives a problem like “debug assertion failed”.
i am using glut on vc++6.0.
as was recommended i am posting my code as well
The include files in the code pertain to processing the textual input by the user and display the corresponding shape.
Why does it take only one input???
is there any way to put it into some kind of while-loop???
HELP.

[This message has been edited by nexusone (edited 09-25-2002).]

Here is a example program that I wrote for someone, it is GLUT based, shows keyboard input, lighting, glu and glut objects.

#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// define glu objects

GLUquadricObj *Cylinder;
GLUquadricObj *Disk;

GLfloat wire_cube, solid_cube, solid_cone; // store objects current rotation
static GLfloat solid_cube_x = -3.0, solid_cube_y = 0.0;
static GLfloat solid_cone_x = 3.0, solid_cone_y = -1.0;
static int wire_cube_rotate = 1, solid_cube_rotate = 1, solid_cone_rotate = 1; // store state; 0= no rotation, 1 = rotation
static GLfloat move_x = 0 , move_y = 0;
static int object_move = 0;

// lighting
GLfloat LightAmbient= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightPosition= { 5.0f, 25.0f, 15.0f, 1.0f };
GLfloat mat_specular = { 1.0, 1.0, 1.0, 1.0 };
static int light_state = 1; // light on = 1, light off = 0
static int cylinder_state = 1; // ends on cylinder = 1, hollow cylinder = 0

void Sprint( int x, int y, char *st)
{
int l,i;

l=strlen( st );
glRasterPos2i( x, y);
for( i=0; i < l; i++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, st[i]);
}

}

static void TimeEvent(int te)
{
int timent;
int i;

if ( object_move == 1)
{
solid_cube_x = move_x;
solid_cube_y = move_y;
}

if ( object_move == 2)
{
solid_cone_x = move_x;
solid_cone_y = move_y;
}

glutPostRedisplay();
glutTimerFunc( 100, TimeEvent, 1);
}

void init(void)
{

glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
// Lighting is added to scene
glLightfv(GL_LIGHT1 ,GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1 ,GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT1 ,GL_POSITION, LightPosition);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT1);

Cylinder = gluNewQuadric();
gluQuadricDrawStyle( Cylinder, GLU_FILL);
gluQuadricNormals( Cylinder, GLU_SMOOTH);
gluQuadricOrientation( Cylinder, GLU_OUTSIDE);
gluQuadricTexture( Cylinder, GL_TRUE);

Disk = gluNewQuadric();
gluQuadricDrawStyle( Disk, GLU_FILL);
gluQuadricNormals( Disk, GLU_SMOOTH);
gluQuadricOrientation( Disk, GLU_OUTSIDE);
gluQuadricTexture( Disk, GL_TRUE);

}

void display(void)
{

glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// easy way to put text on the screen.
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0, 10.0, 10.0, -10.0, -1.0, 30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

if (light_state == 1)
{
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL); // Enable for lighing
}else
{
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL); // Disable for no lighing
}

glColor3f(1.0, 0.5, 0.5);
Sprint(-1, -1, “OpenGL” );

glPushMatrix();// Draw small solid cube
glColor3f(0.0, 1.0, 1.0); // give it a color
glTranslatef( solid_cube_x, solid_cube_y, -20.0); //move it into our our view.
if (solid_cube_rotate == 1) solid_cube++;
if (solid_cube > 360) solid_cube = 0; // check for rotation pass 360, and reset if above.
glRotatef(360 - solid_cube, 0.0, 0.0, 1.0); // rotate on z-axis
glRotatef(solid_cube, 1.0, 0.0, 0.0);
glRotatef(solid_cube, 0.0, 1.0, 0.0);
glutSolidCube(2.0);
glPopMatrix();

glPushMatrix(); // Draw small solid cylinder.
glColor3f(1.0, 0.2, 1.0);
glTranslatef( solid_cone_x, solid_cone_y, -20.0);
if (solid_cone_rotate == 1) solid_cone++;
if (solid_cone > 360) solid_cone = 0;
glRotatef(solid_cone, 0.0, 0.0, 1.0);
glRotatef(360 - solid_cone, 1.0, 0.0, 0.0);
glRotatef(solid_cone, 0.0, 1.0, 0.0);
gluCylinder(Cylinder, 1, 1, 2, 16, 16);
if (cylinder_state == 1)
{
gluDisk(Disk, 0, 1, 16, 2); // Bottom end cap of cylinder
glTranslatef(0.0, 0.0, 2.0);// top end cap of cylinder
gluDisk(Disk, 0, 1, 16, 2);
}
glPopMatrix();

glPushMatrix(); // Draw large wire cube
glColor3f(1.0, 1.0, 1.0);
glTranslatef( 0.0, 0.0, -20.0);
if (wire_cube_rotate == 1) wire_cube++;
if (wire_cube > 360) wire_cube = 0;
glRotatef(wire_cube, 0.0, 0.0, 1.0);
glRotatef(wire_cube, 0.0, 1.0, 0.0);
glRotatef(360 - wire_cube, 0.0, 0.0, 1.0);
glutWireCube(10.0);
glPopMatrix();

glutSwapBuffers();
}

void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
//gluPerspective(60.0,(GLfloat) w/(GLfloat) h, 1.0, 50.0);

}

void keyboard (unsigned char key, int x, int y)
{
switch (key)
{
case ‘W’:
wire_cube_rotate = abs( wire_cube_rotate - 1); // Toggle rotate on off.
break;
case ‘S’:
solid_cube_rotate = abs( solid_cube_rotate - 1); // Toggle rotate on off.
object_move = 1;
move_x = solid_cube_x;
move_y = solid_cube_y;
break;
case ‘C’:
solid_cone_rotate = abs( solid_cone_rotate - 1); // Toggle rotate on off.
object_move = 2;
move_x = solid_cone_x;
move_y = solid_cone_y;
break;
case ‘L’:
light_state = abs(light_state - 1);
break;
case ‘E’:
cylinder_state = abs(cylinder_state - 1);
break;
case 27:
exit(0); // exit program when [ESC] key presseed
break;
default:
break;
}

}

void Special_keys(unsigned char key, int x, int y)
{
switch (key) {
case GLUT_KEY_DOWN:
move_y++;
break;
case GLUT_KEY_UP:
move_y–;
break;
case GLUT_KEY_RIGHT:
move_x++;
break;
case GLUT_KEY_LEFT:
move_x–;
break;
default:
break;
}

}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (10, 10);
glutCreateWindow (argv[0]);
glutSetWindowTitle(“Mike”);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutSpecialFunc(Special_keys);
glutTimerFunc( 10, TimeEvent, 1);
glutMainLoop();
return 0;
}