Imanol

Hi all again and thanks in advance ^^

My question is how can i change the target layer of my graphic card where the mesh (or whatever) is drawn.

Do i have to create a new GraphicsDevice or do i have just to modify it before each entity i want to draw (or something completely different)

How do i modify it if it's the case

How can i know which is the semantic for my chosen layer (in the pixelshader) after having used it to use it in a final draw before the backbuffer is sent to the screen

Thanks



Re: XNA Framework Question about changing default target drawing layer

Shawn Hargreaves - MSFT

I don't understand what you mean by "target layer". Perhaps you are talking about using a custom rendertarget (in XNA that is done using the RenderTarget2D class, and ResolveRenderTarget method).

What exactly are you trying to accomplish





Re: XNA Framework Question about changing default target drawing layer

Imanol

Well... setting the rendertarget as a 2Dtexture is just creating a space in a layer to save there some 2D information (i suppose). I wanted a way to know which the layer was and then work directly with it without having to sample the texture in the shader, but in real what you said works fine for me...

Another question is... that rendertarget texture is always in the gpu memory or it is sometimes stored in another place.





Re: XNA Framework Question about changing default target drawing layer

Shawn Hargreaves - MSFT

I think you need to be careful with your terminology here. "Layer" isn't really a word that means anything in this context - it seems like you're maybe mixing up some other concept that you found somewhere else





Re: XNA Framework Question about changing default target drawing layer

Imanol

Yes... layer is normally used for different symbolic spaces where you can work separately. And here isn't something really different. By layer i mean the spaces in which the graphical memory is "divided" so it can be used for different purpouses.

For example... if you set a new rendertarget different from the deffault one, you are using another layer of the gpu memory to work on it apart from the other layer you where using first. The layers a graphical card can support depends on the graphic card model, maybe their size...

The semantics in the shader TEXCOORD0, TEXCOORD1, etc are layers for me. Zones of memory where you can save different data, but maybe i'm not using the term propperly, dunno.





Re: XNA Framework Question about changing default target drawing layer

Shawn Hargreaves - MSFT

I've never heard layer used in this way - I think you will confuse a lot of people with this!

In graphics, the word "layer" implies some kind of image stacking, where one thing is on top of another, most often with holes so you can see through to the layers below. Like image layers in Photoshop, or perhaps multitexture layers in a pixel shader.

Rendertargets are just different areas of memory that you can switch between, in the same way that TEXCOORD interpolator semantics are just labels referring to different areas of the hardware. There is no stacking going on, and nothing "on top" about one compared to another, so people will find it confusing if you refer to these as layers.





Re: XNA Framework Question about changing default target drawing layer

areia

Since we are on the topic I will place my question here.

I am into creating a multi-viewport version of my XNA game for level editing purposes. I would like very much to have each viewport on a different window (each with a different handle I guess) so I can start up as many viewports I need. I do understand that this involves rendering on a RenderTarget, but how do I render the RenderTarget on another window without creating another GraphicsDevice The problem is that the main GraphicsDevice will render on the main window's handle no matter what. Is this the correct way to think of it, or I miss something





Re: XNA Framework Question about changing default target drawing layer

Shawn Hargreaves - MSFT

You can pass any window handle you like when you call GraphicsDevice.Present.





Re: XNA Framework Question about changing default target drawing layer

areia

Somehow I missed that. Works great! Thanks