Axiom.RenderSystems.OpenGLES.GLESPixelUtil.ConvertToGLformat C# (CSharp) Метод

ConvertToGLformat() публичный статический Метод

public static ConvertToGLformat ( PixelBox data, OpenTK.Graphics.ES11 &outputFormat ) : PixelBox
data Axiom.Media.PixelBox
outputFormat OpenTK.Graphics.ES11
Результат Axiom.Media.PixelBox
		public static PixelBox ConvertToGLformat( PixelBox data, out GLES.All outputFormat )
		{
			GLES.All glFormat = GetGLOriginFormat( data.Format );
			outputFormat = glFormat;
			if ( glFormat != 0 )
			{
				// format already supported
				return data;
			}

			PixelBox converted = null;

			if ( data.Format == PixelFormat.R8G8B8 )
			{
				converted = new PixelBox();
				// Convert BGR -> RGB
				converted.Format = PixelFormat.R8G8B8;
				outputFormat = GLES.All.Rgb;
				converted = new PixelBox( data.Width, data.Height, data.Depth, data.Format );
				converted.Data = data.Data;
				unsafe
				{
					uint* dataptr = (uint*)converted.Data;
					for ( uint i = 0; i < converted.Width * converted.Height; i++ )
					{
						uint* color = dataptr;
						*color = ( *color & 0x000000ff ) << 16 |
								 ( *color & 0x0000FF00 ) |
								 ( *color & 0x00FF0000 ) >> 16;
						dataptr += 1;
					}
				}
			}

			return converted;
		}
	}