Ejemplo n.º 1
0
 float ReadRedAverage()
 {
     if (RenderStack.Graphics.Configuration.canUseFramebufferObject)
     {
         int level = 0;
         int size  = Texture.Size.Width;
         while (size > 1)
         {
             size /= 2;
             ++level;
         }
         framebuffer.AttachTextureLevel(FramebufferAttachment.ColorAttachment0, level);
         float[] pixels = new float[4];
         float[] depths = new float[4];
         GL.ReadBuffer(ReadBufferMode.ColorAttachment0);
         GL.ReadPixels <float>(0, 0, 1, 1, PixelFormat.Red, PixelType.Float, pixels);
         return(pixels[0]);
     }
     else
     {
         return(0.0f);
     }
 }