Jump to content
  • Advertisement
Sign in to follow this  

Help me to understand textures

This topic is 2858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I am relatively new to DirectX programming. I work with SlimDX in C# and try to understand the concept of textures. So far it is easy to create a texture with Texture2D.FromFile but now i would like to know how to fill textures in a dynamic manner. I have set up a DirectShow SampleGrabber and would like to draw the grabbed samples to a texture.

Texture2DDescription textureDescription = new Texture2DDescription()
Width = videoWidth,
Height = videoHeight,
MipLevels = 1,
ArraySize = 1,
Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
Usage = ResourceUsage.Dynamic,
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.Write
Texture2D texture = new Texture2D(device, textureDescription);

Is this kind of instantiation right? How do I do next? It would already be a help if someone had an example of how I put a picture to the texture in this way.

Thanks in advance.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!