RenderTargetRenderer

Tagged:

This class simplifies rendering any FlatRedBall object to a Texture2D (including complex Glue entities).

Quick code example:

bool renderMipMaps = true;
int width = 512;
int height = 512;
RenderTargetRenderer renderer = new RenderTargetRenderer(width, height, renderMipMaps );
EntityType instance = new EntityType (ContentManagerName, false);
instance.AddToManagers(renderer.Camera.Layer);
instance.ForceUpdateDependenciesDeep();
renderer.PerformRender(ContentManagerName, "SomeName");
var texture = renderer.Texture;

Full tutorial and discussion:

http://documentation.flatredball.com/frb/docs/index.php?title=Glue:GlueV...
Updates:

August 18, 2017:
* Fixed crash which can occur if the camera does not have a destination rectangle with top left at 0,0 (common for games which letterbox or pillarbox).

February 1, 2015:

* Added RenderableLayer to simplify adding multiple layers to a RenderTargetRenderer and having it render on command.

January 27, 2015:

* Added ReRender function so that the same RenderTargetRenderer can be used multiple times.

September 1, 2014
* Fixed not setting the alpha blend.

August 28, 2014:
* Fixed bug caused by not calling ForceUpdateDependencies on the Camera prior to rendering
* Fixed bug caused by not defaulting the Camera to Z = 40
* Fixed bug with Camera not setting DrawsWorld to false

RenderTargetRenderer
Product File: 
Syndicate content