/// <summary> /// Returns the color id of the hitted face. /// If the id == 0, then nothing was hit. /// </summary> /// <param name="gl"></param> /// <param name="posX">The X position in the scene.</param> /// <param name="posY">The Y position in the scene.</param> /// <returns>The color id of the hitted face.</returns> public uint DoHitTest(OpenGL gl, int posX, int posY ) { // Ensure the hit test scene is up to date. if (HtProgram.ChangedUniforms.Count == 0) { byte[] pixels = new byte[4]; gl.ReadPixels(posX, posY, 1, 1, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, pixels); return new ColorF(pixels[3], pixels[0], pixels[1], pixels[2]).ToUint(); } return 0; }