public RenderTarget2D( GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage ) : base( graphicsDevice, width, height, mipMap, preferredFormat ) { DepthStencilFormat = preferredDepthFormat; MultiSampleCount = FNA3D.FNA3D_GetMaxMultiSampleCount( graphicsDevice.GLDevice, Format, MathHelper.ClosestMSAAPower(preferredMultiSampleCount) ); RenderTargetUsage = usage; if (MultiSampleCount > 0) { glColorBuffer = FNA3D.FNA3D_GenColorRenderbuffer( graphicsDevice.GLDevice, Width, Height, Format, MultiSampleCount, texture ); } // If we don't need a depth buffer then we're done. if (DepthStencilFormat == DepthFormat.None) { return; } glDepthStencilBuffer = FNA3D.FNA3D_GenDepthStencilRenderbuffer( graphicsDevice.GLDevice, Width, Height, DepthStencilFormat, MultiSampleCount ); }
/// <summary> /// Initializes a new instance of the <see cref="RenderTargetCube"/> class. /// </summary> /// <param name="graphicsDevice">The graphics device.</param> /// <param name="size">The width and height of a texture cube face in pixels.</param> /// <param name="mipMap"> /// <see langword="true"/> to generate a full mipmap chain; otherwise <see langword="false"/>. /// </param> /// <param name="preferredFormat">The preferred format of the surface.</param> /// <param name="preferredDepthFormat">The preferred format of the depth-stencil buffer.</param> /// <param name="preferredMultiSampleCount">The preferred number of multisample locations.</param> /// <param name="usage">The usage mode of the render target.</param> public RenderTargetCube( int size, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage ) : base( size, mipMap, preferredFormat ) { var graphicsDevice = GraphicsDeviceManager.Instance.GraphicsDevice; DepthStencilFormat = preferredDepthFormat; MultiSampleCount = FNA3D.FNA3D_GetMaxMultiSampleCount( graphicsDevice.GLDevice, Format, MathHelper.ClosestMSAAPower(preferredMultiSampleCount) ); RenderTargetUsage = usage; if (MultiSampleCount > 0) { glColorBuffer = FNA3D.FNA3D_GenColorRenderbuffer( graphicsDevice.GLDevice, Size, Size, Format, MultiSampleCount, texture ); } // If we don't need a depth buffer then we're done. if (DepthStencilFormat == DepthFormat.None) { return; } glDepthStencilBuffer = FNA3D.FNA3D_GenDepthStencilRenderbuffer( graphicsDevice.GLDevice, Size, Size, DepthStencilFormat, MultiSampleCount ); }