Forum
Contact





DirectX using C#
DirectX using C++
DirectX using Visual Basic



Latest Forum posts

 Suggestion to change a few lines
  Posted by: Insomnica
  When: 06/09/2010 at 14:37:05

 Collision with series 1
  Posted by: radulph
  When: 05/09/2010 at 13:33:14

 HLSL calculating normals
  Posted by: miroslavign
  When: 04/09/2010 at 17:26:26

 Collision with series 1
  Posted by: ToastbrotX
  When: 04/09/2010 at 16:52:02

 HLSL calculating normals
  Posted by: Rich_Zap
  When: 04/09/2010 at 15:00:20

 Collision with series 1
  Posted by: ToastbrotX
  When: 04/09/2010 at 12:28:41

 HLSL calculating normals
  Posted by: miroslavign
  When: 04/09/2010 at 08:46:31

 Walk along a wall
  Posted by: Anonymous
  When: 03/09/2010 at 10:28:02

 model problems
  Posted by: muffinman
  When: 03/09/2010 at 06:47:32

 Vertices problem
  Posted by: Anonymous
  When: 03/09/2010 at 05:48:35

 OcTree Question
  Posted by: Zorzomezz
  When: 03/09/2010 at 04:07:03

 error x3000:syntax error
  Posted by: Anonymous
  When: 02/09/2010 at 06:55:17

 Reflection problem in corners ...
  Posted by: Anonymous
  When: 31/08/2010 at 20:53:30

 OcTree Question
  Posted by: radulph
  When: 31/08/2010 at 18:00:04

 model problems
  Posted by: Archenon
  When: 30/08/2010 at 05:54:27

 Changing computer breaks my game
  Posted by: Archenon
  When: 30/08/2010 at 05:49:50

 model problems
  Posted by: muffinman
  When: 28/08/2010 at 16:58:10

 Vertices problem
  Posted by: Anonymous
  When: 27/08/2010 at 15:35:36

 Changing computer breaks my game
  Posted by: radulph
  When: 27/08/2010 at 07:12:24

 effects file and XNA 4.0 (Beta)
  Posted by: radulph
  When: 26/08/2010 at 06:33:33




Topic: TextureCoordinate



  
Goto parent category
  
Create a new user account


   TextureCoordinate
 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.

  
Post a new reply
 





Google
 
Web www.riemers.net
If you appreciate the amount of time I spend creating and updating
these pages, feel free to donate -- any amount is welcome !
- Website design & DirectX code : Riemer Grootjans -
©2006 Riemer Grootjans


News
Home
Forum
XNA 2.0 Recipes Book (8)
XNA 3.0 Recipes Book (8)
Downloads
Extra Reading (3)
Matrices: geometrical
Matrix Mathematics
Homogenous matrices
Community Projects (1)
Tutorials (160)
XNA 3.0 using C# (89)
DirectX using C# (54)
Series 1:Terrain (14)
Opening a window
Linking to the Device
Drawing a triangle
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing bmp files
Colored vertices
DirectX Light basics
Mesh creation
Mesh lighting
Series 2: Flightsim (19)
Series 3: HLSL (19)
Short Tuts (2)
Resizing problem
Checking Device caps
DirectX using C++ (15)
DirectX using VB (2)