| Poster | : Kilorn | | Posts | : 7 | | Country | : United States | | City | : Atlanta |
| | | | Posted by Kilorn on 31/10/2008 at 21:28:11
| | Hey guys, I get an error whenever I try to run the code from this chapter. I can't seem to figure out where "TextureCoordinate" is defined and neither can XNA.
By "TextureCoordinate" I mean in the following lines:
terrainVertices[x + y * terrainWidth].TextureCoordinate.X = (float)x / 30.0f;
terrainVertices[x + y * terrainWidth].TextureCoordinate.Y = (float)y / 30.0f;
I know it's gotta be something really simple that I'm somehow missing, but it's kind of late after a really long day at work, and my brain doesn't really want to work right now. Thanks in advance! | |
|
|
| |
| |
| Poster | : evlhamburger | | Posts | : 102 | | Country | : Australia | | City | : Brisbane |
| | | | Posted by evlhamburger on 31/10/2008 at 21:32:11
| | It seems you have used "TextureCoordinate.X" and ".Y" instead of ".U" and ".V"...
try that... :P
Then check if you are using VertexPositionNormalTexture (Or are you using a custom one? I forget XNA :S) | |
|
|
| |
| |
| Poster | : Kilorn | | Posts | : 7 | | Country | : United States | | City | : Atlanta |
| | | | Posted by Kilorn on 31/10/2008 at 21:36:00
| | | Figured out the problem with the code not finding the definition for TextureCoordinate, but now when I run the program, the entire terrain is colored red with one small strip of blue which changes to black when I move around. | |
|
|
| |
| |
| Poster | : evlhamburger | | Posts | : 102 | | Country | : Australia | | City | : Brisbane |
| | | | Posted by evlhamburger on 31/10/2008 at 21:37:31
| | | So what was the problem? | |
|
|
| |
| |
| Poster | : evlhamburger | | Posts | : 102 | | Country | : Australia | | City | : Brisbane |
| | | | Posted by evlhamburger on 31/10/2008 at 21:39:22
| | Thatsounds like an effect problem... or maybe you aren't clearing the right buffers for the device?
Are you clearing the depth buffer? Is the texture being loaded correctly?
Post more code. | |
|
|
| |
| |
| Poster | : Kilorn | | Posts | : 7 | | Country | : United States | | City | : Atlanta |
| | | | Posted by Kilorn on 31/10/2008 at 21:40:13
| | | I changed the name of the struct by mistake without realizing. Now I've gotten figure out this new issue listed above. | |
|
|
| |
| |
| Poster | : Kilorn | | Posts | : 7 | | Country | : United States | | City | : Atlanta |
| | | | Posted by Kilorn on 31/10/2008 at 21:43:46
| | New issue resolved already as well. I placed the following code in the Draw method instead of the DrawTerrain method:
effect.CurrentTechnique = effect.Techniques["Textured"];
effect.Parameters["xTexture"].SetValue(grassTexture);
Thanks a lot for your help. I owe ya. | |
|
|