Example #1
0
        private void GlControl_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                tbX.Text = e.X.ToString();
                tbY.Text = e.Y.ToString();

                int x = e.X;
                int y = glControl.Height - e.Y;

                byte[] pixels = new byte[4];

                glControl.Invalidate();
                GL.ReadPixels(x, y, 1, 1, OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.UnsignedByte, pixels);

                tbPixR.Text = pixels[0].ToString();
                tbPixG.Text = pixels[1].ToString();
                tbPixB.Text = pixels[2].ToString();

                captGlShape = glList.Where(ee => ee.HashColor == pixels[0]).FirstOrDefault();
                if (captGlShape != null)
                {
                    if (captGlShape is LegGlShape)
                    {
                        gbLegData.DataContext = (captGlShape as LegGlShape).Leg;
                    }
                }
            }
        }
Example #2
0
 private void GlControl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     captGlShape = null;
 }