Texture class confusion....Texture, Texture2d, Texture3d, TextureCollection, Texture Sampler arrays

Started by
0 comments, last by MJP 12 years, 9 months ago
Hello. I can't seem to find a lot of info about this. I'm using XNA 4.0 for Windows for what it matters.

1. The Texture2d class is defined as a collection of texels. The Texture class is defined as a Texture resource. Very helpful. What is the relationship between Texture and Texture2D?

2. I need to refer to an array of texture samplers in PixelShader 2.0 by a variable indice....i.e., tex2D(TextureSamplerArray, texcoords), where is not defined at compile time. Which is not supported. Should I use Texture3d or a TextureCollection to pull this off? I can't find any info about TextureCollection at all besides MS's barebones definition and would rather not have to code myself into a corner to find out.

Thanks for the help.
Advertisement

Hello. I can't seem to find a lot of info about this. I'm using XNA 4.0 for Windows for what it matters.

1. The Texture2d class is defined as a collection of texels. The Texture class is defined as a Texture resource. Very helpful. What is the relationship between Texture and Texture2D?

2. I need to refer to an array of texture samplers in PixelShader 2.0 by a variable indice....i.e., tex2D(TextureSamplerArray, texcoords), where is not defined at compile time. Which is not supported. Should I use Texture3d or a TextureCollection to pull this off? I can't find any info about TextureCollection at all besides MS's barebones definition and would rather not have to code myself into a corner to find out.

Thanks for the help.


1. Texture is an abstract base class. It just contains functionality common to the 3 texture types (Texture2D, Texture3D, and TextureCube).

2. TextureCollection is not a resource type. It has the name "collection" as in the kind of collections you find in System.Collections. It's basically just an array of Texture's. The class exists for the Textures property of GraphicsDevice.

What you're trying to accomplish is most commonly achieved using a texture atlas. You can probably dig up some resources on terrain rendering that implement something similar.

This topic is closed to new replies.

Advertisement