Textured Box Tutorial

Textured Box Tutorial

Thanks for all the effort in the tutorial on cerating a textured box in XNA.

I was looking to see if anyone had insight, some code, or example that would show how to place different texture on each side of the box, instead of the same texture repeated.

Thanks

ripps7
06/20/2009 - 19:28

Decided to try and break down the VertexBuffer into 6 buffers... each holding 6 Vertices (1 group for each face of cube).

Needed to change cubeEffect.Texture each time before calling cube.RenderShape

cubeEffect.Begin()
cubeEffect.Texture = Texture1 // Texture2, etc..
cube.RenderShape(...)
cubeEffect.End()

This is repeated 6 times in the Draw method, each time adding a differet texture.

It works fine. Other then making a loop to repeat this short bit of code 6 times, is there a more efficent way to do this?

Thanks!

reply

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.