Using OpenTK in devStudio 15 and windows forms on my dell desktop. When I render a color (eg red = 255, 0, 0, 255), and read the results back it is about, but not quite half of the written value, eg 127, 0, 0, 127.
private void GetHitMap()
{
// copy hitmap from screen
IntPtr unmanagedPointer = Marshal.AllocHGlobal(_hitMap.Length);
GL.ReadBuffer(ReadBufferMode.Back);
GL.ReadPixels(0, 0, renderCanvas.Width, renderCanvas.Height, PixelFormat.Rgba, PixelType.Byte, unmanagedPointer);
Marshal.Copy(unmanagedPointer, _hitMap, 0, _hitMap.Length);
Marshal.FreeHGlobal(unmanagedPointer);
}
On a laptop, running the same code, same extremely simple shaders, but different gpu, the red is sometime red on the screen, and sometimes 'half red' and the values I read back are sometimes not exactly half, Using a framebuffer in opengl instead of Marshalling gives the same results. All other colors and using r,g,b or any combination gives the same result. I was planning to use 'designated colors' to identify objects, similar to a shadow map, but the colors are not consistent. Is this a known or expected behavior? Is it fixable? Running out of things to look for.