Axiom.RenderSystems.OpenGL.GLPixelUtil.GetGLOriginFormat C# (CSharp) Метод

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

Takes the Axiom pixel format and returns the appropriate GL one
public static GetGLOriginFormat ( PixelFormat format ) : int
format PixelFormat Axiom PixelFormat
Результат int
		public static int GetGLOriginFormat( PixelFormat format )
		{
			switch ( format )
			{
				case PixelFormat.A8:
					return Gl.GL_ALPHA;
				case PixelFormat.L8:
					return Gl.GL_LUMINANCE;
				case PixelFormat.L16:
					return Gl.GL_LUMINANCE;
				case PixelFormat.BYTE_LA:
					return Gl.GL_LUMINANCE_ALPHA;
				case PixelFormat.R3G3B2:
					return Gl.GL_RGB;
				case PixelFormat.A1R5G5B5:
					return Gl.GL_BGRA;
				case PixelFormat.R5G6B5:
					return Gl.GL_RGB;
				case PixelFormat.B5G6R5:
					return Gl.GL_BGR;
				case PixelFormat.A4R4G4B4:
					return Gl.GL_BGRA;
				case PixelFormat.R8G8B8:
					return Gl.GL_BGR;
				case PixelFormat.B8G8R8:
					return Gl.GL_RGB;
				case PixelFormat.X8R8G8B8:
				case PixelFormat.A8R8G8B8:
					return Gl.GL_BGRA;
				case PixelFormat.X8B8G8R8:
				case PixelFormat.A8B8G8R8:
					return Gl.GL_RGBA;
				case PixelFormat.B8G8R8A8:
					return Gl.GL_BGRA;
				case PixelFormat.R8G8B8A8:
					return Gl.GL_RGBA;
				case PixelFormat.A2R10G10B10:
					return Gl.GL_BGRA;
				case PixelFormat.A2B10G10R10:
					return Gl.GL_RGBA;
				case PixelFormat.FLOAT16_R:
					return Gl.GL_LUMINANCE;
				case PixelFormat.FLOAT16_GR:
					return Gl.GL_LUMINANCE_ALPHA;
				case PixelFormat.FLOAT16_RGB:
					return Gl.GL_RGB;
				case PixelFormat.FLOAT16_RGBA:
					return Gl.GL_RGBA;
				case PixelFormat.FLOAT32_R:
					return Gl.GL_LUMINANCE;
				case PixelFormat.FLOAT32_GR:
					return Gl.GL_LUMINANCE_ALPHA;
				case PixelFormat.FLOAT32_RGB:
					return Gl.GL_RGB;
				case PixelFormat.FLOAT32_RGBA:
					return Gl.GL_RGBA;
				case PixelFormat.SHORT_RGBA:
					return Gl.GL_RGBA;
				case PixelFormat.SHORT_RGB:
					return Gl.GL_RGB;
				case PixelFormat.SHORT_GR:
					return Gl.GL_LUMINANCE_ALPHA;
				case PixelFormat.DXT1:
					return Gl.GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
				case PixelFormat.DXT3:
					return Gl.GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
				case PixelFormat.DXT5:
					return Gl.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
			}

			return 0;
		}

Usage Example

Пример #1
0
 public override void BlitToMemory(BasicBox srcBox, PixelBox dst)
 {
     if (!this._buffer.Contains(srcBox))
     {
         throw new ArgumentException("Source box out of range.");
     }
     if (srcBox.Left == 0 && srcBox.Right == Width && srcBox.Top == 0 && srcBox.Bottom == Height && srcBox.Front == 0 &&
         srcBox.Back == Depth && dst.Width == Width && dst.Height == Height && dst.Depth == Depth &&
         GLPixelUtil.GetGLOriginFormat(dst.Format) != 0)
     {
         // The direct case: the user wants the entire texture in a format supported by GL
         // so we don't need an intermediate buffer
         download(dst);
     }
     else
     {
         // Use buffer for intermediate copy
         allocateBuffer();
         // Download entire buffer
         download(this._buffer);
         if (srcBox.Width != dst.Width || srcBox.Height != dst.Height || srcBox.Depth != dst.Depth)
         {
             //TODO Implement Image.Scale
             throw new Exception("Image scaling not yet implemented");
             // We need scaling
             //Image.Scale( _buffer.GetSubVolume( srcBox ), dst, ImageFilter.BiLinear );
         }
         else
         {
             // Just copy the bit that we need
             PixelConverter.BulkPixelConversion(this._buffer.GetSubVolume(srcBox), dst);
         }
         freeBuffer();
     }
 }
All Usage Examples Of Axiom.RenderSystems.OpenGL.GLPixelUtil::GetGLOriginFormat