示例#1
0
        private static void Mouse(int button, int state, int x, int y) {
            Node point;

            if(button == Glut.GLUT_LEFT_BUTTON && state == Glut.GLUT_DOWN) {
                point = new Node();
                point.Next = points;
                point.X = x;
                point.Y = y;
                point.R = (byte) (random.Next() % 256);
                point.G = (byte) (random.Next() % 256);
                point.B = (byte) (random.Next() % 256);
                points = point;
                Glut.glutPostRedisplay();
            }
        }
示例#2
0
        // --- Application Methods ---
        #region Init()
        private static void Init() {
            Node point;

            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glDepthFunc(Gl.GL_LEQUAL);
            Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            Gl.glPointSize(4.0f);

            while(points != null) {
                point = points;
                points = points.Next;
                point = null;
            }
        }
示例#3
0
        private static void Keyboard(byte key, int x, int y) {
            Node point;

            switch(key) {
                case 27:
                    while(points != null) {
                        point = points;
                        points = points.Next;
                        point = null;
                    }
                    Environment.Exit(0);
                    break;
                case (byte) 'r':
                case (byte) 'R':
                    while(points != null) {
                        point = points;
                        points = points.Next;
                        point = null;
                    }
                    break;
                case (byte) 'p':
                case (byte) 'P':
                    drawPoints = !drawPoints;
                    break;
                case (byte) '\r':
                    Init();
                    break;
                default:
                    break;
            }

            Glut.glutPostRedisplay();
        }