public Texture2D( GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format ) { if (graphicsDevice == null) { throw new ArgumentNullException("graphicsDevice"); } GraphicsDevice = graphicsDevice; Width = width; Height = height; LevelCount = mipMap ? CalculateMipLevels(width, height) : 1; // TODO: Use QueryRenderTargetFormat! if (this is IRenderTarget && format != SurfaceFormat.Color && format != SurfaceFormat.Rgba1010102 && format != SurfaceFormat.Rg32 && format != SurfaceFormat.Rgba64 && format != SurfaceFormat.Single && format != SurfaceFormat.Vector2 && format != SurfaceFormat.Vector4 && format != SurfaceFormat.HalfSingle && format != SurfaceFormat.HalfVector2 && format != SurfaceFormat.HalfVector4 && format != SurfaceFormat.HdrBlendable) { Format = SurfaceFormat.Color; } else { Format = format; } texture = FNA3D.FNA3D_CreateTexture2D( GraphicsDevice.GLDevice, Format, Width, Height, LevelCount, (byte)((this is IRenderTarget) ? 1 : 0) ); }