Not recognizing Keyboard or Mouse interrupts

m workin on visual c#2008 and using Tao.openGl for drawing some graphics. my code draws the cube but doesnt recognize any keyboard/mouse interrupts…
please help me out

// form1.cs code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tao.Platform.Windows;
using Tao.OpenGl;
using Tao.FreeGlut;

namespace tao2cube
{
public partial class Form1 : Form
{

    public Form1()
    {
        
        InitializeComponent();
       

        simpleOpenGlControl1.InitializeContexts();
       
        Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB|Glut.GLUT_DEPTH);
        Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);//for Background
        Gl.glColor3f(1.0f, 1.0f, 0.0f);//colour for the primitive
        Gl.glPointSize(5.0f);
        Gl.glMatrixMode(Gl.GL_PROJECTION);
        Gl.glLoadIdentity();
        Gl.glOrtho(-1.0, 1.0, -1.0, 1.0,-1.0,1.0);
        this.simpleOpenGlControl1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.simpleOpenGlControl1_KeyPress);

     
        Gl.glEnable(Gl.GL_DEPTH_TEST);
       
      



    }
  private void simpleOpenGlControl1_Resize(object sender, EventArgs e)
    
   {
        Size s = new Size();
        this.OnResize(e);
        reshape(s.Width, s.Height);
        Glut.glutPostOverlayRedisplay();

        
    }
   private void simpleOpenGlControl1_KeyPress(object sender, KeyPressEventArgs e)
   {
       this.OnKeyPress(e);
      
       
     Point p = new Point();
      p = MousePosition;
     Keys key = new Keys();
     int k = System.Convert.ToInt32(key);
     
    
      specialKey(k,p.X,p.Y);

   }



   private void simpleOpenGlControl1_Paint(object sender, PaintEventArgs e)
    {
        this.OnPaint(e);
        drawings();
        
       Glut.glutPostOverlayRedisplay();
       // Glut.glutSwapBuffers();
    }
    private void simpleOpenGlControl1_Load(object sender, EventArgs e)
    {

    }

    private void Form1_Load(object sender, EventArgs e)
    {
       
    }





    static float[] theta={0,0,0};
    static int axis=2;
   
   public static void drawings()
    {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT );
            Gl.glPushMatrix();
           Gl.glBegin(Gl.GL_LINE_LOOP);
           Gl.glVertex3f(0.25f, 0.25f, 1.0f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(-0.75f, 0.25f, 1f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(-0.75f, -0.75f, 1f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(0.25f, -0.75f, 1f);
           Gl.glEnd();

           Gl.glBegin(Gl.GL_LINE_LOOP);
           Gl.glVertex3f(0.5f, 0.5f, 0f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(-0.5f, 0.5f, 0f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(-0.5f, -0.5f, 0f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(0.5f, -0.5f, 0f);
           Gl.glEnd();

           Gl.glBegin(Gl.GL_LINE_STRIP);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(-0.5f, 0.5f, 0f);
           Gl.glColor3f(1f, 0.5f, 1f);
           Gl.glVertex3f(-0.75f, 0.25f, 1f);
           Gl.glColor3f(0.6f, 0.5f, 1.0f);
           Gl.glVertex3f(-0.75f, -0.75f, 1f);
           Gl.glColor3f(1f, 0f, 0.5f);
           Gl.glVertex3f(-0.5f, -0.5f, 0f);
           Gl.glColor3f(0f, 0.5f, 1.0f);
           Gl.glVertex3f(0.5f, -0.5f, 0f);
           Gl.glColor3f(0f, 0.5f, 0f);
           Gl.glVertex3f(0.25f, -0.75f, 1f);
           Gl.glEnd();
           Gl.glBegin(Gl.GL_LINE_STRIP);
           Gl.glVertex3f(0.5f, 0.5f, 0f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glVertex3f(0.25f, 0.25f, 1f);
           Gl.glColor3f(1f, 0.5f, 0f);
           Gl.glEnd();
           Gl.glFlush();
           Gl.glPopMatrix();
           Glut.glutPostOverlayRedisplay();
       }

    
  public  static void spincube()
   {
        theta[axis] += 0.2f;
        if (theta[axis] > 360) theta[axis] -= 360;
        Glut.glutPostRedisplay();
    }
public static void specialKey(int key,int x,int y)
{
      // Check which key is pressed
     switch (key)
          {
              case Glut.GLUT_KEY_LEFT:    // Rotate on x axis
                  axis = 0;
                  break;
              case Glut.GLUT_KEY_RIGHT:    // Rotate on x axis (opposite)
                  axis = 1;
                  break;
              case Glut.GLUT_KEY_UP:        // Rotate on y axis 
                  axis = 2;
                  break;
              
              default:
                  break;
          }
         spincube();
          Glut.glutPostOverlayRedisplay();
     
}
 
  
  public static void reshape(int w, int h)
   {
       Gl.glViewport(0, 0, w, h);
       Gl.glMatrixMode(Gl.GL_PROJECTION);        // Set the Matrix mode
       Gl.glLoadIdentity();
       if (w <= h)
       {
           Gl.glOrtho(-2, 2, -2 * (float)h / (float)w, 2 * (float)h / (float)w, -10, 10); ;
       }
       else
       {
           Gl.glOrtho(-2, 2, -2 * (float)h / (float)w, 2 * (float)h / (float)w, -10, 10);
       }


       Gl.glMatrixMode(Gl.GL_MODELVIEW);


   }
}      

}

// form1.cs code over

// program.cs code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Tao.FreeGlut;
using Tao.OpenGl;
using Tao.Platform.Windows;

namespace tao2cube
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

       Glut.glutInit();
        Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
       Glut.glutReshapeFunc(tao2cube.Form1.reshape);
        Glut.glutDisplayFunc(tao2cube.Form1.drawings);
        Glut.glutIdleFunc(tao2cube.Form1.drawings);
      
     Glut.glutSpecialFunc(new Glut.SpecialCallback(tao2cube.Form1.specialKey));
        
        Application.Run(new Form1());

        Glut.glutMainLoop();
    }
    
        
        
}

}

Did you try with glutKeyboardFunc and glutMouseFunc? Because I don’t see it in your code.

thanks for the reply… i changed the code and made it simple and included the glutMouseFunc but stil its not workin…
plz help… m in deep trouble

following in my new code

//form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tao.FreeGlut;
using Tao.OpenGl;
using Tao.Platform.Windows;

namespace keybrdprog
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
simpleOpenGlControl1.InitializeContexts();
Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);//for Background
Gl.glColor3f(0.7f, 0.7f, 0.7f);//colour for the primitive
Gl.glEnable(Gl.GL_LIGHTING);
Gl.glEnable(Gl.GL_LIGHT0);
Gl.glShadeModel(Gl.GL_SMOOTH);
Gl.glEnable(Gl.GL_DEPTH_TEST);
Gl.glEnable(Gl.GL_NORMALIZE);
}

    private void simpleOpenGlControl1_Load(object sender, EventArgs e)
    {
        
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        
    }

    static float[] theta = {0,0,0};
    static int axis = 2;
    public static void drawings()
    {
        float[] mat_ambient = { 0.7f, 0.7f, 0.7f, 1.0f }; // gray
        float[] mat_diffuse = { .5f, .5f, .5f, 1.0f };
        float[] mat_specular = { 1.0f, 1.0f, 1.0f, 1.0f };
        float[] mat_shininess = { 50.0f };
        Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT, mat_ambient);
        Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, mat_diffuse);
        Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_SPECULAR, mat_specular);
        Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_SHININESS, mat_shininess);

        //set the light source properties
        float[] lightIntensity = { 0.7f, 0.7f, 0.7f, 1.0f };
        float[] light_position = { -0.9f, -0.9f, -0.9f, 0.0f };
        Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light_position);
        Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_DIFFUSE, lightIntensity);

        Gl.glMatrixMode(Gl.GL_PROJECTION);
        Gl.glLoadIdentity();

        Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
        Gl.glLoadIdentity();

        Gl.glRotatef(theta[0], 1, 0, 0);
        Gl.glRotatef(theta[1], 0, 1, 0);
        Gl.glRotatef(theta[2], 0, 0, 1);

        Glut.glutWireTorus(0.1, 0.2, 100, 100);
        Gl.glFlush();
        Glut.glutPostOverlayRedisplay();
    }
    public static void mymouse(int btn, int state, int x, int y)
    {
        if (btn == Glut.GLUT_LEFT_BUTTON && state == Glut.GLUT_DOWN)
        { axis = 0; }
        if (btn == Glut.GLUT_MIDDLE_BUTTON && state == Glut.GLUT_DOWN)
        { axis = 1; }
        if (btn == Glut.GLUT_RIGHT_BUTTON && state == Glut.GLUT_DOWN)
        { axis = 2; }
        theta[axis] += 2;
        if (theta[axis] &gt; 360)
        {
            theta[axis] -= 360;
        }
        drawings();
    }

    private void simpleOpenGlControl1_Paint(object sender, PaintEventArgs e)
    {
        this.OnPaint(e);
        drawings();
        Glut.glutPostOverlayRedisplay();
    }

}

}

//program.cs code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Tao.FreeGlut;
using Tao.OpenGl;
using Tao.Platform.Windows;

namespace keybrdprog
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Glut.glutInit();
Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
Glut.glutMouseFunc(new Glut.MouseCallback(keybrdprog.Form1.mymouse));
Glut.glutIdleFunc(new Glut.IdleCallback(keybrdprog.Form1.drawings));
Glut.glutDisplayFunc(keybrdprog.Form1.drawings);
Application.Run(new Form1());
Glut.glutMainLoop();
}
}
}