<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Import textures</title>
		<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures</link>
		<description>Posts in the discussion thread &quot;Import textures&quot;</description>
				<copyright></copyright>
		<lastBuildDate>Mon, 20 Jul 2026 19:01:53 +0000</lastBuildDate>
		
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2177301</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2177301</link>
				<description></description>
				<pubDate>Thu, 11 Dec 2014 17:17:59 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Oh yes&#8230;. now it is working perfectly !!</p> <p>Thanks a lot for your support and your explanations to provide a better understanding for the newbies like me.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2176678</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2176678</link>
				<description></description>
				<pubDate>Thu, 11 Dec 2014 03:24:22 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>So I did probably the exact same thing as you and got the exact same results. The bottom face looks fine, but all the others are partially transparent and definitely black.</p> <p>So I added these three lines instead, and it worked:</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-identifier">graphics</span><span class="hl-code">.</span><span class="hl-identifier">GraphicsDevice</span><span class="hl-code">.</span><span class="hl-identifier">BlendState</span><span class="hl-code"> = </span><span class="hl-identifier">BlendState</span><span class="hl-code">.</span><span class="hl-identifier">AlphaBlend</span><span class="hl-code">; </span><span class="hl-identifier">graphics</span><span class="hl-code">.</span><span class="hl-identifier">GraphicsDevice</span><span class="hl-code">.</span><span class="hl-identifier">DepthStencilState</span><span class="hl-code"> = </span><span class="hl-identifier">DepthStencilState</span><span class="hl-code">.</span><span class="hl-identifier">Default</span><span class="hl-code">; </span><span class="hl-identifier">graphics</span><span class="hl-code">.</span><span class="hl-identifier">GraphicsDevice</span><span class="hl-code">.</span><span class="hl-identifier">SamplerStates</span><span class="hl-brackets">[</span><span class="hl-number">0</span><span class="hl-brackets">]</span><span class="hl-code"> = </span><span class="hl-identifier">SamplerState</span><span class="hl-code">.</span><span class="hl-identifier">LinearWrap</span><span class="hl-code">;</span></pre></div> </div> <p>With those, I'm being quite a bit more aggressive with resetting graphics device state.</p> <p>When you do stuff with SpriteBatch, it sets a variety of states on the graphics device, to get it to draw things a certain way. It doesn't bother to unset them. That seems like poor design, at first glance. (OK, it actually always seems like poor design, but&#8230;) The reason for this is just how low level graphics APIs tend to work. They're state machines that maintain a specific state once moved to it, up until there's a reason to change to something else. Since we weren't doing anything to set it back to the way it was, it stays in the &quot;wrong&quot; state and our drawing for the box ends up looking funky.</p> <p>The original line we both put in attempts to revert that, but it doesn't revert everything. It has worked just fine for me in many, many cases, but not in this one.</p> <p>So I got more aggressive and reset the blend state, the depth stencil state, and the sampler state all back to what we'd typically expect in 3D drawing.</p> <p>Anyway, try out those three lines just before drawing in 3D or just after drawing in 2D. It should fix it for you.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2176052</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2176052</link>
				<description></description>
				<pubDate>Wed, 10 Dec 2014 08:26:22 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Well, while awaiting your answer I had tried with the single line of code you show in the tutorial about 2D/3D combination, but the results were identical, this is, only one texture in one face.</p> <p>I put the line after spriteBatch.End() (so 2D drawing was over) and right before calling DrawModel(), where the 3D model drawing takes place. Is that the right location for that line of code ?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2175917</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2175917</link>
				<description></description>
				<pubDate>Wed, 10 Dec 2014 04:31:21 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Yeah, you can still draw a texture in the background or foreground. Or lots of them. It's quite common, with a UI and everything. There's a bit of a trick that you have to do, which I describe in this tutorial: <a href="http://rbwhitaker.wikidot.com/2d3d-combined">2D and 3D Combined</a>.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2174625</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2174625</link>
				<description></description>
				<pubDate>Mon, 08 Dec 2014 10:28:41 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi again,</p> <p>Now it is working. But first a couple of comments&#8230;.</p> <p>About the model file. I did not rid off the mipmaps (I do not know what they are) and I did not switch profile to HiDef (I did not know I could). This is, I used the model exactly as I sent it to you. The code you sent worked fine with the model I had sent to you.</p> <p>The first difference in my code with yours was that in Draw method you were looping ModelMesh through model.Meshes, and then ModelMeshPart through mesh.MeshPart. In my code I had it exactly as in the tutorial, this is, ModelMesh loop and then BasicEffect loop through mesh.Effects. But this did not make my code to work.</p> <p>The second difference had nothing to do with the model itself. I was using Texture2D as background (your stars image) and drawing to screen with SpriteBatch &amp; Co&#8230;.. This was interferencing in some way with the model and avoiding the correct display of the textures. Once I changed it, the model was perfectly shown on screen with the full six textures on the corresponding faces, exactly as with the code you sent.</p> <p>May I ask why would the background Texture2D was a problem ? I still want this, or other, background to be used. How could I do it ?</p> <p>Thanks a lot for your support.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2174286</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2174286</link>
				<description></description>
				<pubDate>Sun, 07 Dec 2014 20:28:10 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi RB,</p> <p>Thanks a lot for your support. I've made a quick test, and your code works ok with my model. I mean, I didn't touch anything in my project, just I did replace my code at Game1.cs with the one in your post&#8230; and it did work perfectly.</p> <p>I'll check now what's the difference between our codes and let you know.</p> <p>Thanks again.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2174148</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2174148</link>
				<description></description>
				<pubDate>Sun, 07 Dec 2014 16:24:50 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>OK, I just got a chance to download the model and to play around with it. It does seem to be working fine for me, though I had to make a few tweaks to get the model to load. Considering the fact that you've said you're already seeing it draw part of the model, I imagine you've already made similar adjustments.</p> <p>What I did to get it to load is this, though:</p> <p>1. Got rid of the mipmaps. The model was set up to generate mipmaps, but the model content processor didn't want to do that because the images weren't a power of two. You could definitely make them a power of two and keep the mipmaps, but to just get it to display, I didn't care for the mipmaps and so disabling them was the easiest choice.<br /> 2. Switched my profile from Reach to HiDef. Again, this was because Reach required powers of two, while HiDef does not.</p> <p>Considering you're seeing the model at all, you've probably already accounted for these two little bumps in the road.</p> <p>Now here's the bottom line. <strong>The model worked fine for me, so as you suspected, it was probably some small problem with your code.</strong></p> <p>I'm including my code below. Half of the non-template code in there is to get it to spin in circles, so you'll see I've got what amounts to a spherical coordinate with my distance, theta angle, and phi angle. (Don't worry too much if you don't understand that. Your problem is probably down in the Draw method somewhere, so compare your current code against that.)</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">Collections</span><span class="hl-code">.</span><span class="hl-identifier">Generic</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">Linq</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Audio</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Content</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">GamerServices</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Graphics</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Input</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Media</span><span class="hl-code">; </span><span class="hl-identifier">namespace</span><span class="hl-code"> </span><span class="hl-identifier">WindowsGame3</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// This is the main type for your game</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">Game1</span><span class="hl-code"> : </span><span class="hl-identifier">Microsoft</span><span class="hl-code">.</span><span class="hl-identifier">Xna</span><span class="hl-code">.</span><span class="hl-identifier">Framework</span><span class="hl-code">.</span><span class="hl-identifier">Game</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">GraphicsDeviceManager</span><span class="hl-code"> </span><span class="hl-identifier">graphics</span><span class="hl-code">; </span><span class="hl-identifier">SpriteBatch</span><span class="hl-code"> </span><span class="hl-identifier">spriteBatch</span><span class="hl-code">; </span><span class="hl-reserved">private</span><span class="hl-code"> </span><span class="hl-identifier">Model</span><span class="hl-code"> </span><span class="hl-identifier">model</span><span class="hl-code">; </span><span class="hl-reserved">private</span><span class="hl-code"> </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">theta</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-reserved">private</span><span class="hl-code"> </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">phi</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-reserved">private</span><span class="hl-code"> </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">distance</span><span class="hl-code"> = </span><span class="hl-number">5000</span><span class="hl-code">; </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-identifier">Game1</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">graphics</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">GraphicsDeviceManager</span><span class="hl-brackets">(</span><span class="hl-reserved">this</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">Content</span><span class="hl-code">.</span><span class="hl-identifier">RootDirectory</span><span class="hl-code"> = </span><span class="hl-quotes">&quot;</span><span class="hl-string">Content</span><span class="hl-quotes">&quot;</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// Allows the game to perform any initialization it needs to before starting to run.</span><span class="hl-code"> </span><span class="hl-comment">/// This is where it can query for any required services and load any non-graphic</span><span class="hl-code"> </span><span class="hl-comment">/// related content. Calling base.Initialize will enumerate through any components</span><span class="hl-code"> </span><span class="hl-comment">/// and initialize them as well.</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-reserved">protected</span><span class="hl-code"> </span><span class="hl-identifier">override</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">Initialize</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// TODO: Add your initialization logic here</span><span class="hl-code"> </span><span class="hl-identifier">base</span><span class="hl-code">.</span><span class="hl-identifier">Initialize</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// LoadContent will be called once per game and is the place to load</span><span class="hl-code"> </span><span class="hl-comment">/// all of your content.</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-reserved">protected</span><span class="hl-code"> </span><span class="hl-identifier">override</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">LoadContent</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// Create a new SpriteBatch, which can be used to draw textures.</span><span class="hl-code"> </span><span class="hl-identifier">spriteBatch</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">SpriteBatch</span><span class="hl-brackets">(</span><span class="hl-identifier">GraphicsDevice</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">model</span><span class="hl-code"> = </span><span class="hl-identifier">Content</span><span class="hl-code">.</span><span class="hl-identifier">Load</span><span class="hl-code">&lt;</span><span class="hl-identifier">Model</span><span class="hl-code">&gt;</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">Preba</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// UnloadContent will be called once per game and is the place to unload</span><span class="hl-code"> </span><span class="hl-comment">/// all content.</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-reserved">protected</span><span class="hl-code"> </span><span class="hl-identifier">override</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">UnloadContent</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// TODO: Unload any non ContentManager content here</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// Allows the game to run logic such as updating the world,</span><span class="hl-code"> </span><span class="hl-comment">/// checking for collisions, gathering input, and playing audio.</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;param name=&quot;gameTime&quot;&gt;Provides a snapshot of timing values.&lt;/param&gt;</span><span class="hl-code"> </span><span class="hl-reserved">protected</span><span class="hl-code"> </span><span class="hl-identifier">override</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">Update</span><span class="hl-brackets">(</span><span class="hl-identifier">GameTime</span><span class="hl-code"> </span><span class="hl-identifier">gameTime</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// Allows the game to exit</span><span class="hl-code"> </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">GamePad</span><span class="hl-code">.</span><span class="hl-identifier">GetState</span><span class="hl-brackets">(</span><span class="hl-identifier">PlayerIndex</span><span class="hl-code">.</span><span class="hl-identifier">One</span><span class="hl-brackets">)</span><span class="hl-code">.</span><span class="hl-identifier">Buttons</span><span class="hl-code">.</span><span class="hl-identifier">Back</span><span class="hl-code"> == </span><span class="hl-identifier">ButtonState</span><span class="hl-code">.</span><span class="hl-identifier">Pressed</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-reserved">this</span><span class="hl-code">.</span><span class="hl-identifier">Exit</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-identifier">theta</span><span class="hl-code"> += </span><span class="hl-number">0.05</span><span class="hl-identifier">f</span><span class="hl-code">; </span><span class="hl-identifier">phi</span><span class="hl-code"> += </span><span class="hl-number">0.01</span><span class="hl-identifier">f</span><span class="hl-code">; </span><span class="hl-identifier">base</span><span class="hl-code">.</span><span class="hl-identifier">Update</span><span class="hl-brackets">(</span><span class="hl-identifier">gameTime</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-reserved">private</span><span class="hl-code"> </span><span class="hl-identifier">Vector3</span><span class="hl-code"> </span><span class="hl-identifier">SphericalToCartesian</span><span class="hl-brackets">(</span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">theta</span><span class="hl-code">, </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">phi</span><span class="hl-code">, </span><span class="hl-types">float</span><span class="hl-code"> </span><span class="hl-identifier">distance</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-types">double</span><span class="hl-code"> </span><span class="hl-identifier">x</span><span class="hl-code"> = </span><span class="hl-identifier">distance</span><span class="hl-code"> * </span><span class="hl-identifier">Math</span><span class="hl-code">.</span><span class="hl-identifier">Sin</span><span class="hl-brackets">(</span><span class="hl-identifier">phi</span><span class="hl-brackets">)</span><span class="hl-code"> * </span><span class="hl-identifier">Math</span><span class="hl-code">.</span><span class="hl-identifier">Cos</span><span class="hl-brackets">(</span><span class="hl-identifier">theta</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-types">double</span><span class="hl-code"> </span><span class="hl-identifier">y</span><span class="hl-code"> = </span><span class="hl-identifier">distance</span><span class="hl-code"> * </span><span class="hl-identifier">Math</span><span class="hl-code">.</span><span class="hl-identifier">Cos</span><span class="hl-brackets">(</span><span class="hl-identifier">phi</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-types">double</span><span class="hl-code"> </span><span class="hl-identifier">z</span><span class="hl-code"> = </span><span class="hl-identifier">distance</span><span class="hl-code"> * </span><span class="hl-identifier">Math</span><span class="hl-code">.</span><span class="hl-identifier">Sin</span><span class="hl-brackets">(</span><span class="hl-identifier">phi</span><span class="hl-brackets">)</span><span class="hl-code"> * </span><span class="hl-identifier">Math</span><span class="hl-code">.</span><span class="hl-identifier">Sin</span><span class="hl-brackets">(</span><span class="hl-identifier">theta</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Vector3</span><span class="hl-brackets">((</span><span class="hl-types">float</span><span class="hl-brackets">)</span><span class="hl-identifier">x</span><span class="hl-code">, </span><span class="hl-brackets">(</span><span class="hl-types">float</span><span class="hl-brackets">)</span><span class="hl-identifier">y</span><span class="hl-code">, </span><span class="hl-brackets">(</span><span class="hl-types">float</span><span class="hl-brackets">)</span><span class="hl-identifier">z</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// This is called when the game should draw itself.</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;/summary&gt;</span><span class="hl-code"> </span><span class="hl-comment">/// &lt;param name=&quot;gameTime&quot;&gt;Provides a snapshot of timing values.&lt;/param&gt;</span><span class="hl-code"> </span><span class="hl-reserved">protected</span><span class="hl-code"> </span><span class="hl-identifier">override</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">Draw</span><span class="hl-brackets">(</span><span class="hl-identifier">GameTime</span><span class="hl-code"> </span><span class="hl-identifier">gameTime</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">GraphicsDevice</span><span class="hl-code">.</span><span class="hl-identifier">Clear</span><span class="hl-brackets">(</span><span class="hl-identifier">Color</span><span class="hl-code">.</span><span class="hl-identifier">CornflowerBlue</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">foreach</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">ModelMesh</span><span class="hl-code"> </span><span class="hl-identifier">mesh</span><span class="hl-code"> </span><span class="hl-identifier">in</span><span class="hl-code"> </span><span class="hl-identifier">model</span><span class="hl-code">.</span><span class="hl-identifier">Meshes</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">foreach</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">ModelMeshPart</span><span class="hl-code"> </span><span class="hl-identifier">part</span><span class="hl-code"> </span><span class="hl-identifier">in</span><span class="hl-code"> </span><span class="hl-identifier">mesh</span><span class="hl-code">.</span><span class="hl-identifier">MeshParts</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">BasicEffect</span><span class="hl-code"> </span><span class="hl-identifier">effect</span><span class="hl-code"> = </span><span class="hl-brackets">(</span><span class="hl-identifier">BasicEffect</span><span class="hl-brackets">)</span><span class="hl-identifier">part</span><span class="hl-code">.</span><span class="hl-identifier">Effect</span><span class="hl-code">; </span><span class="hl-identifier">effect</span><span class="hl-code">.</span><span class="hl-identifier">World</span><span class="hl-code"> = </span><span class="hl-identifier">Matrix</span><span class="hl-code">.</span><span class="hl-identifier">Identity</span><span class="hl-code">; </span><span class="hl-identifier">effect</span><span class="hl-code">.</span><span class="hl-identifier">View</span><span class="hl-code"> = </span><span class="hl-identifier">Matrix</span><span class="hl-code">.</span><span class="hl-identifier">CreateLookAt</span><span class="hl-brackets">(</span><span class="hl-identifier">SphericalToCartesian</span><span class="hl-brackets">(</span><span class="hl-identifier">theta</span><span class="hl-code">, </span><span class="hl-identifier">phi</span><span class="hl-code">, </span><span class="hl-identifier">distance</span><span class="hl-brackets">)</span><span class="hl-code">, </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Vector3</span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code">, </span><span class="hl-identifier">Vector3</span><span class="hl-code">.</span><span class="hl-identifier">UnitY</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">effect</span><span class="hl-code">.</span><span class="hl-identifier">Projection</span><span class="hl-code"> = </span><span class="hl-identifier">Matrix</span><span class="hl-code">.</span><span class="hl-identifier">CreatePerspectiveFieldOfView</span><span class="hl-brackets">(</span><span class="hl-identifier">MathHelper</span><span class="hl-code">.</span><span class="hl-identifier">ToRadians</span><span class="hl-brackets">(</span><span class="hl-number">45</span><span class="hl-brackets">)</span><span class="hl-code">, </span><span class="hl-number">800</span><span class="hl-identifier">f</span><span class="hl-code">/</span><span class="hl-number">480</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">1</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">8000</span><span class="hl-identifier">f</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-identifier">mesh</span><span class="hl-code">.</span><span class="hl-identifier">Draw</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-identifier">base</span><span class="hl-code">.</span><span class="hl-identifier">Draw</span><span class="hl-brackets">(</span><span class="hl-identifier">gameTime</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span></pre></div> </div> <p>If your code looks the same as this, or if you run this code and it still looks wrong, my next guess is that it might not be able to find all of the textures or process them all correctly. So the next thing I'd look at if this code doesn't work for you is to double-check that all six of your textures are in the same directory as the model and that you don't have any compiler warnings (or errors) when you build the full project from scratch. (Do like a Build &gt; Rebuild All on the menu.)</p> <p>Hope that helps&#8230;</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2173652</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2173652</link>
				<description></description>
				<pubDate>Sat, 06 Dec 2014 17:56:06 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Ok, this is something (maybe a link or maybe not)&#8230;</p> <p><a href="http://www.filedropper.dom/mymodel">www.filedropper.com/mymodel</a></p> <p>The zip contains the fbx in ASCII format already edited to point the textures in the same folder. Also there are the six png files with the textures.</p> <p>Thanks.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2173643</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2173643</link>
				<description></description>
				<pubDate>Sat, 06 Dec 2014 17:39:38 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Yeah, I just wanted to rule out a problem with the model itself before diving into code.</p> <p>I should have said something about the linking thing. When you're new, the Wikidot system doesn't let you post links in an effort to prevent spam. You do have to make several posts before your karma level goes up high enough to where you can post direct links. I'm not sure what the exact number is, but it's something like 10 or 25. What people do instead in the mean time is just post something like &quot;www (dot) example (dot) com (slash) path/to/file&quot;. Basically, make it not look like a real URL to fool the system. I can go in and edit the post manually so that it works correctly, but even with that sort of hacked/broken URL, I can figure out well enough what it should be to keep helping you.</p> <p>Unfortunately, I don't have control over this setting. It's a Wikidot setting, and I can't do anything about it. Eventually, you'll get enough karma to where you can post links.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2173613</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2173613</link>
				<description></description>
				<pubDate>Sat, 06 Dec 2014 16:52:09 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>				<wikidot:authorUserId>2024713</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi, and thanks for your quick answer. I was not thinking on a general XNA problem&#8230; but more in a programming mistake on my code&#8230;</p> <p>I'm trying to post a link with the model, but I'm not allowed to&#8230; (maybe low karma ?)</p> <p>Regards.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2173525</guid>
				<title>Re: Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2173525</link>
				<description></description>
				<pubDate>Sat, 06 Dec 2014 14:03:31 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I don't think I've heard of this being a general XNA problem. Seems like it should work. Any chance you could post a link to the model or to another model that has the same problem?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-1061222#post-2173426</guid>
				<title>Import textures</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-1061222/import-textures#post-2173426</link>
				<description></description>
				<pubDate>Sat, 06 Dec 2014 10:03:27 +0000</pubDate>
				<wikidot:authorName>YoHidden</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi,</p> <p>I'm quite a newbie in this XNA programming. I'm trying to import an fbx object (a single rectangular prism) that uses a different texture for each of its faces. I have made this model in Sketchup and export it from there to fbx. The exported fbx file is in Ascii format and when edited, I can see correctly referenced the six texture files (actually .png format). I've added the contents to the project and used LoadContent method to load it into the application.</p> <p>Up to here, everything is fine. But when I run the application, the model only show one of the six textures in only one of its six faces. The other faces seem to have the background colour of the texture, but no the image itself. The only texture shown is properly positioned, scaled and on the correct face.</p> <p>I have tried as well to manually add the texture to the various basic effects of the mesh. In that case, the same face is shown with its correct texture, but the other faces are totally obscured (and a little transparent).</p> <p>What am I missing ?</p> <p>Thanks in advance for your help.</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>