plz help me making a very simple key board interaction !
i have different functions like
void line(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex2i(600, 430); //strating point of alif
glVertex2i(600, 450); // ending of alif
glEnd();
glFlush();
}
void circle(void)
{
glBegin(GL_POINTS);
glVertex2i(550,437);
glVertex2i(550,436);
glVertex2i(550,435);
glVertex2i(550,434);
glVertex2i(550,433);
glVertex2i(549,432);
glEnd();
glBegin(GL_LINES);
glVertex2i(547,431);
glVertex2i(525,431);
glEnd();
glBegin(GL_POINTS);
glVertex2i(524,432);
glVertex2i(524,433);
glVertex2i(524,434);
glVertex2i(524,435);
glVertex2i(524,436);
glVertex2i(539,425);
glEnd();
glFlush();
}
and here is mykeyborad
void mykeyboard(unsigned char key, int x, int y)
{
switch(key)
{
case 'L':
line();
case 'C':
circle();
case 'Esc' ://exit
exit(0);
}
in main i callback mykeyborad
glutKeyboardFunc(mykeyboard);
but this is not working
if i press ‘L’
the line function should be activated and a line should b displayed at screen
then if i press ‘C’
a circle should be displayed
can any1 help me regarding keyborad interaction;