Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


XNA 4 RenderTarget Stencil Buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 danromeo   Members   -  Reputation: 238

Like
0Likes
Like

Posted 26 August 2014 - 02:30 PM

Hi.  

 

Can somebody explain to me or point me to a resource on using a basic stencil buffer on a render target in XNA 4?  I'm finding a lot of XNA 3 resources and I know that it's changed in XNA 4, and a lot of articles on XNA4 that are overkill and confusing.  

 

I want a rendertarget with a stencil buffer, which is drawn to during initialization.  Then at draw time I want to pass the render target to the pixel shader, selecting pixels from the passed render target to render to the current render target, but discarding pixels based on the original render target's stencil buffer.  

 

I THINK, correct me if I'm wrong:

 

The graphics device has a stencil buffer which is zeroed out when you set the rendertarget.  

 

I have to enable the stencil buffer.  

 

I can set the game state to compare the graphics device stencil buffer and the render target stencil buffer at draw time.  

 

BUT, how do I set the values in the render target stencil buffer?  

 

Also I'm using Multiple Render Targets, if this makes any difference.  

 

I know this is probably simple stuff but I'm not finding any resource that gives a simple explanation of What It Is and How To Use It.

 

Thanks


Edited by danromeo, 26 August 2014 - 02:34 PM.


Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 4846

Like
0Likes
Like

Posted 27 August 2014 - 11:53 AM

In XNA 4.0 the stencil buffer (and depth buffer) are tied to the particular render target - you specify it when you create the render target. So you can't set a new render target and use the stencil buffer from a previous one.

 

What exactly are you trying to do?


Edited by phil_t, 27 August 2014 - 11:54 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS