<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>http://forums.xna.com/forums/32.aspx</link><description>Don't know where to post your question? Post it here!</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Rendertarget Ignorance</title><link>http://forums.xna.com/forums/thread/59051.aspx</link><pubDate>Sat, 26 Apr 2008 15:38:42 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:59051</guid><dc:creator>Byron Nelson</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/59051.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=59051</wfw:commentRss><description>&lt;P&gt;If the draw is being called over and over, I'm afraid I don't follow.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Draw()&lt;/P&gt;
&lt;P&gt;.. starts on backbuffer&lt;/P&gt;
&lt;P&gt;..draws stuff fine, &lt;/P&gt;
&lt;P&gt;set new rendertarget (what gets cleared at this point?)&lt;/P&gt;
&lt;P&gt;draw to new target&lt;/P&gt;
&lt;P&gt;set back to backbuffer (what gets cleared at this point?)&lt;/P&gt;
&lt;P&gt;repeat..&amp;nbsp;&amp;nbsp;regardless of the clearing, I would think when draw gets called the next time I'd get my screen.&amp;nbsp; At worst, I'd expect flickering between purple &amp;amp; my normal screen.&amp;nbsp;&amp;nbsp; I tried to set the rendertarget to preservecontents when I initialized it, but I get the purple screen.&amp;nbsp; I'll plug in your code &amp;amp; see what happens.&lt;/P&gt;&lt;FONT color=#00ff00&gt;
&lt;P&gt;texture_for_text &lt;/FONT&gt;&lt;FONT color=#008080&gt;=&lt;/FONT&gt;&lt;FONT color=#00ff00&gt; &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#ff00ff&gt;new&lt;/B&gt;&lt;/FONT&gt;&lt;FONT color=#00ff00&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;RenderTarget2D&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;(gd, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;300&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;300&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;1&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;, gd&lt;/FONT&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;PresentationParameters&lt;/FONT&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;BackBufferFormat,&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;RenderTargetUsage&lt;/FONT&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;PreserveContents)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#00ff00&gt;[EDIT]&amp;nbsp; I get it now.&amp;nbsp; When I change from backbuffer to new target, backbuffer gets cleared in purple.&amp;nbsp; Since that is the last part of my draw function, thats all I see.&amp;nbsp;&amp;nbsp;&amp;nbsp; If I move the rendertarget rendering to the front of the draw function, then switch to the backbuffer &amp;amp; render the scene normally, it works fine.&amp;nbsp;&amp;nbsp; Thanks again Shawmishrak, you are always helpful,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#00ff00&gt;Best,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#00ff00&gt;Byron&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#00ff00&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;</description></item><item><title>Re: Rendertarget Ignorance</title><link>http://forums.xna.com/forums/thread/59050.aspx</link><pubDate>Sat, 26 Apr 2008 15:22:26 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:59050</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/59050.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=59050</wfw:commentRss><description>By default, XNA GS is configured to clear the contents of render targets when they are bound, to make render targets consistent across Windows and Xbox.&amp;nbsp; That's why you get a purple screen when you use your render target.&amp;nbsp; In general, what you want to do is render all of your render targets, then render the back buffer.&lt;br&gt;&lt;br&gt;You can override this behavior to keep render target contents instead of clearing.&amp;nbsp; You will need to attach an event handler to the PreparingDeviceSettings event in your game's GraphicsDeviceManager instance.&amp;nbsp; In your event handler, you'll have a PreparingDeviceSettingsEventArgs parameter that you need to modify.&lt;br&gt;&lt;br&gt;&lt;div style="background-color:White;"&gt;&lt;div style="margin:0px;padding:2px 2px 2px 8px;background-color:White;overflow-x:scroll;overflow-y:hidden;width:505px;"&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;public&lt;/span&gt; MyGame()&lt;br&gt;{&lt;br&gt;    &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;this&lt;/span&gt;.graphics.PreparingDeviceSettings += OnPreparingDeviceSettings;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;private&lt;/span&gt; &lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;void&lt;/span&gt; OnPreparingDeviceSettings(&lt;span style="color:Blue;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;object&lt;/span&gt; sender, PreparingDeviceSettingsEventArgs args)&lt;br&gt;{&lt;br&gt;    args.PresentationParameters.RenderTargetUsage &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; RenderTargetUsage.PreserveContents;&lt;br&gt;&lt;br&gt;    &lt;span style="color:Green;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;// or....&lt;/span&gt;&lt;br&gt;&lt;br&gt;    args.PresentationParameters.RenderTargetUsage &lt;span style="color:Red;background-color:transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; RenderTargetUsage.PlatformContents;&lt;br&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;PlatformContents is faster, but it won't work right on Xbox.&amp;nbsp; You'll still get a cleared render target.&amp;nbsp; If you only care about Windows, then it's fine.&lt;br&gt;</description></item><item><title>Re: Rendertarget Ignorance</title><link>http://forums.xna.com/forums/thread/59048.aspx</link><pubDate>Sat, 26 Apr 2008 14:39:47 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:59048</guid><dc:creator>Byron Nelson</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/59048.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=59048</wfw:commentRss><description>&lt;P&gt;I'm doing nothing with it at this point.&amp;nbsp; I was just trying to compile and run to see if I had everything snytactially sound.&lt;/P&gt;
&lt;P&gt;The main draw loop draws my space game.&amp;nbsp; Put_text puts up my framerate info.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;If I drop in&amp;nbsp;the routing to put text on a texture, I get a purple screen.&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;If I comment out everything in that function and just put &lt;/P&gt;&lt;FONT color=#00ff00&gt;
&lt;P&gt;gd&lt;/FONT&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;SetRenderTarget(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;0&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;, texture_for_text);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#00ffff&gt;//gd.Clear(Color.Black);&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#00ffff&gt;// put_text(text, Vector2.Zero, Color.Yellow,gd);&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;
&lt;P&gt;gd&lt;/FONT&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;SetRenderTarget(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;0&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#ff00ff&gt;null&lt;/B&gt;&lt;/FONT&gt;&lt;FONT color=#00ff00&gt;);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#00ffff&gt;// texture_with_text = texture_for_text.GetTexture();&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;I get a purple screen when the game runs.&lt;/P&gt;
&lt;P&gt;The code below is my draw function.&amp;nbsp; Commenting and uncommenting line&amp;nbsp;28 switches between a nice looking game and a static purple screen.&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR:white;"&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;WIDTH:525px;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:white;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt;9&lt;BR&gt;10&lt;BR&gt;11&lt;BR&gt;12&lt;BR&gt;13&lt;BR&gt;14&lt;BR&gt;15&lt;BR&gt;16&lt;BR&gt;17&lt;BR&gt;18&lt;BR&gt;19&lt;BR&gt;20&lt;BR&gt;21&lt;BR&gt;22&lt;BR&gt;23&lt;BR&gt;24&lt;BR&gt;25&lt;BR&gt;26&lt;BR&gt;27&lt;BR&gt;28&lt;BR&gt;29&lt;BR&gt;30&lt;BR&gt;31&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD style="WIDTH:465px;"&gt;
&lt;DIV style="PADDING-RIGHT:2px;OVERFLOW-Y:hidden;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;OVERFLOW:scroll;WIDTH:465px;PADDING-TOP:2px;"&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;General_lighting.Light_effects_light_settings.SetValue(General_lighting.light_parameters_array);&lt;BR&gt;            &lt;BR&gt;Warship.draw(camera.view_matrix,camera.projection_matrix,General_lighting.Light_effects,sky.stars);&lt;BR&gt;&lt;BR&gt;graphics.GraphicsDevice.RenderState.AlphaBlendEnable &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;          &lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (lambda_ray.on)&lt;BR&gt;lambda_ray.draw(camera.view_matrix, camera.projection_matrix, view_frustrum.corners[3], General_lighting.Light_effects,graphics.GraphicsDevice);&lt;BR&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;PRE&gt;&lt;BR&gt;Laserbolts.draw(camera.view_matrix, camera.projection_matrix, graphics.GraphicsDevice, General_lighting.Light_effects);&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;plasma.draw(camera.view_matrix, camera.projection_matrix, General_lighting.Light_effects, graphics.GraphicsDevice);&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (Warship_shield.impacted) &lt;BR&gt;    Warship_shield.draw(camera.view_matrix, camera.projection_matrix, General_lighting.Light_effects, graphics.GraphicsDevice);&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;torpedos.Draw(camera.view_matrix, camera.projection_matrix, General_lighting.Light_effects, graphics.GraphicsDevice);&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Text_handler.put_text(Text_handler.framerateinfo, Vector2.Zero, Color.Yellow, graphics.GraphicsDevice);&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:green;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;//  Text_handler.text_on_texture("what the hell", Vector2.Zero, Color.Yellow, graphics.GraphicsDevice);&lt;/SPAN&gt;&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;graphics.GraphicsDevice.RenderState.AlphaBlendEnable &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt;;&lt;BR&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;base&lt;/SPAN&gt;.Draw(gameTime);&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Byron&lt;/P&gt;</description></item><item><title>Re: Rendertarget Ignorance</title><link>http://forums.xna.com/forums/thread/59047.aspx</link><pubDate>Sat, 26 Apr 2008 14:22:40 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:59047</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/59047.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=59047</wfw:commentRss><description>How are you using texture_with_text after rendering to it?&lt;br&gt;</description></item><item><title>Rendertarget Ignorance</title><link>http://forums.xna.com/forums/thread/59044.aspx</link><pubDate>Sat, 26 Apr 2008 13:49:56 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:59044</guid><dc:creator>Byron Nelson</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/59044.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=59044</wfw:commentRss><description>&lt;P&gt;I am trying to put some text on a texture.&amp;nbsp;&amp;nbsp; This is my first venture into render targets, and I would think from what I've seen in the help files this little class should work.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The put_text function and text_on_texture functions are called in the main Draw().&amp;nbsp; Put_text works fine.&amp;nbsp;&amp;nbsp; The text_on_texture function gives my game a purple screen.&amp;nbsp;&amp;nbsp; Any reference to the correct reading material would be much appreciated.&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR:white;"&gt;
&lt;DIV style="BACKGROUND-COLOR:white;"&gt;
&lt;DIV style="BACKGROUND-COLOR:white;"&gt;
&lt;TABLE style="BORDER-RIGHT:#e5e5e5 1px solid;BORDER-TOP:#e5e5e5 1px solid;BORDER-LEFT:#e5e5e5 1px solid;WIDTH:525px;BORDER-BOTTOM:#e5e5e5 1px solid;BACKGROUND-COLOR:white;" cellSpacing=0 cellPadding=0&gt;

&lt;TR style="VERTICAL-ALIGN:top;LINE-HEIGHT:normal;"&gt;
&lt;TD style="WIDTH:40px;TEXT-ALIGN:right;"&gt;&lt;PRE style="BORDER-RIGHT:#e7e7e7 1px solid;PADDING-RIGHT:2px;PADDING-LEFT:2px;FONT-SIZE:11px;PADDING-BOTTOM:2px;MARGIN:0px;COLOR:gray;PADDING-TOP:2px;FONT-FAMILY:courier new;"&gt;1&lt;BR&gt;2&lt;BR&gt;3&lt;BR&gt;4&lt;BR&gt;5&lt;BR&gt;6&lt;BR&gt;7&lt;BR&gt;8&lt;BR&gt;9&lt;BR&gt;10&lt;BR&gt;11&lt;BR&gt;12&lt;BR&gt;13&lt;BR&gt;14&lt;BR&gt;15&lt;BR&gt;16&lt;BR&gt;17&lt;BR&gt;18&lt;BR&gt;19&lt;BR&gt;20&lt;BR&gt;21&lt;BR&gt;22&lt;BR&gt;23&lt;BR&gt;24&lt;BR&gt;25&lt;BR&gt;26&lt;BR&gt;27&lt;BR&gt;28&lt;BR&gt;29&lt;BR&gt;30&lt;BR&gt;31&lt;BR&gt;32&lt;BR&gt;33&lt;BR&gt;34&lt;BR&gt;35&lt;BR&gt;36&lt;BR&gt;37&lt;BR&gt;38&lt;BR&gt;39&lt;BR&gt;40&lt;BR&gt;41&lt;BR&gt;42&lt;BR&gt; &lt;/PRE&gt;&lt;/TD&gt;
&lt;TD style="WIDTH:465px;"&gt;
&lt;DIV style="PADDING-RIGHT:2px;OVERFLOW-Y:hidden;PADDING-LEFT:8px;PADDING-BOTTOM:2px;MARGIN:0px;OVERFLOW:scroll;WIDTH:465px;PADDING-TOP:2px;"&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;class&lt;/SPAN&gt; text_handling&lt;BR&gt;{&lt;BR&gt;   SpriteFont  the_font;&lt;BR&gt;   SpriteBatch batch_o_font;&lt;BR&gt;   RenderTarget2D texture_for_text;&lt;BR&gt;   Texture2D texture_with_text;&lt;BR&gt;&lt;BR&gt;   &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;void&lt;/SPAN&gt; load_and_assign(ContentManager content,  GraphicsDevice gd)&lt;BR&gt;   {&lt;BR&gt;       texture_for_text &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt;   &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; RenderTarget2D(gd, 300, 300, 1, gd.PresentationParameters.BackBufferFormat);&lt;BR&gt;&lt;BR&gt;       texture_with_text &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Texture2D(gd, 300, 300, 2, TextureUsage.None, gd.PresentationParameters.BackBufferFormat);&lt;BR&gt;&lt;BR&gt;       batch_o_font &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; SpriteBatch(gd);&lt;BR&gt;&lt;BR&gt;       the_font &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; content.Load&amp;lt;SpriteFont&amp;gt;(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"SpriteFont1"&lt;/SPAN&gt;);&lt;BR&gt;   }&lt;BR&gt;&lt;BR&gt;   &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;void&lt;/SPAN&gt; put_text(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt; text_to_put, Vector2 position, Color color, GraphicsDevice gd)&lt;BR&gt;   {&lt;BR&gt;       &lt;BR&gt;       batch_o_font.Begin();&lt;BR&gt;        batch_o_font.DrawString(the_font,text_to_put,position,color);&lt;BR&gt;       batch_o_font.End();&lt;BR&gt;&lt;BR&gt;       gd.RenderState.DepthBufferEnable &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;true&lt;/SPAN&gt;; &lt;BR&gt;   }&lt;BR&gt;&lt;BR&gt;   &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;void&lt;/SPAN&gt; text_on_texture(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;string&lt;/SPAN&gt; text, Vector2 position, Color color, GraphicsDevice gd)&lt;BR&gt;   {&lt;BR&gt;       gd.SetRenderTarget(0, texture_for_text);&lt;BR&gt;&lt;BR&gt;       gd.Clear(Color.Black);&lt;BR&gt;&lt;BR&gt;       put_text(text, Vector2.Zero, Color.Yellow,gd);&lt;BR&gt;&lt;BR&gt;       gd.SetRenderTarget(0, &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;null&lt;/SPAN&gt;);&lt;BR&gt;&lt;BR&gt;       texture_with_text &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; texture_for_text.GetTexture();&lt;BR&gt;   }&lt;BR&gt;&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description></item></channel></rss>