I'm trying a new approach to texturing a model (a generated 3D landscape) but I'm having some unexpected behaviour I'm hoping someone will be able to pinpoint for me.
Firstly my model is built as follows
- I load a list of heights of each square tile - the map is 128x128 tiles in size
- I create the model in triangle strips
- I load a test image to use for a texture that is 128x128 pixels in size
- The texture is set to the image that was loaded then the model is drawn
Here's what my model comes out looking like - this is a picture taken from looking straight down at the model. The lines aren't 100% straight as the section of the model shown isn't flat so I'm not worried about that.
(http://img32.imageshack.us/img32/5323/screen7af.png)
Here's the texture. Each quad in my model correllates to exactly 1 pixel in the source texture.
(http://img7.imageshack.us/img7/4894/texturetest.png)
Here's how I create the model
FOR Z=0 TO (ModelSizeZ-2)
ZTexValue1=1/(128/(Z+1)) // Set the first Z offset into the texture image
ZTexValue2=1/(128/(Z+2)) // Set the second Z offset into the texture image
X_OBJNEWGROUP
FOR X=0 TO (MapSizeX-2) STEP 2
XTexValue1=1/(128/(X+1)) // Set the first X offset into the texture image
XTexValue2=1/(128/(X+2)) // Set the second X offset into the texture image
X_OBJADDVERTEX X, HeightsArray[X][Z+1], Z+1, 0,0, RGB(255,255,255) // Create quad. Bottom left corner
X_OBJADDVERTEX X, HeightsArray[X][Z], Z, 0,1, RGB(255,255,255) // Top left corner
X_OBJADDVERTEX X+1, HeightsArray[X+1][Z+1], Z+1, 1,0, RGB(255,255,255) // Bottom right corner
X_OBJADDVERTEX X+1, HeightsArray[X+1][Z], Z, 1,1, RGB(255,255,255) // Top right Corner
ENDIF
NEXT
NEXT
My issues
1) Any idea why am I getting the image coming out looking like it's made up of joined up strips? I would've expected everything to blend together nicely, but instead I get the lines in it where two strips of triangles meet.
2) Each tile (ie square of 2 triangles) should be a solid colour. How do I stop each colour from blending into the next one so that each square's doesn't blend into those of the squares next to it? Is this because of the small texture image size? (128x128 pixels)