Click to Rate and Give Feedback
MSDN
MSDN Library
XNA Game Studio
XNA Game Studio 3.1
 Textures Property
Collapse All/Expand All Collapse All
XNA Game Studio 3.1
GraphicsDevice.Textures Property
Returns the collection of textures that have been assigned to the texture stages of the device.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

C#
public TextureCollection Textures { get; }

Property Value

The texture collection.
The collection of texture stage on the device contains one or more textures (all of the same type and dimensions) that can be accessed by shaders.
Bb199371.note(en-us,XNAGameStudio.31).gifNote
At draw time, a texture cannot be simultaneously set as a render target and a texture at a stage.

This C# code demonstrates the setting two elements of the Textures collection to two user-created Texture2D objects named firstTexture and secondTexture.

C#
graphics.GraphicsDevice.Textures[0] = firstTexture;
graphics.GraphicsDevice.Textures[1] = secondTexture;
      

In the effect file, these textures can be accessed by declaring two sampler variables and setting them to the sampler register numbers that correspond to the index in the texture collection.

Effect File (.fx)
sampler firstSampler : register(s0);
sampler secondSampler : register(s1);
      
Xbox 360, Windows XP SP2, Windows Vista
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker