I have been racking my brains on a texturing problem for a week and have no solution so I am throwing the question up here for the community... Help!
I am trying to achieve a checker board effect on a large square mesh (single surface). The checker pattern is randomized at the start of the game so I can not used a static grid texture and apply it to the mesh. I have successfully loaded a small UV mapped texture and can place this one "square" on the mesh at any location I wish. Now I need to place another 20 or so on the same mesh to create my game board. To keep things simple I really want to use only one mesh for the board and not a set of "tiles". I have no idea how to best achieve this.
My first thought was to use multitexturing but that would be completely inefficient and has extreme limitations. What I think needs to be achieved is to paint or stamp each little square onto the mesh texture at run time. Am I on the right track here?
The code is rather long and complex but starts off by creating a mesh, a surface and 4 vertices at 0,0,0 + 100,0,0 + 100,0,100 + 0,0,100 linked to the surface. I then connect the vertices to create two triangles from v0+v1+v2 and v0+v2+v3. I then color the mesh white.
Next I clear the textureflags and load a 16x16 UV clamped texture which is completely red (one square). I then scale the texture by .10, .10. Finally I texture the board mesh on texture layer 2 and position the UV on the texture so the square appears where I need it.
All thoughts and comments appreciated!
-- X2
I am trying to achieve a checker board effect on a large square mesh (single surface). The checker pattern is randomized at the start of the game so I can not used a static grid texture and apply it to the mesh. I have successfully loaded a small UV mapped texture and can place this one "square" on the mesh at any location I wish. Now I need to place another 20 or so on the same mesh to create my game board. To keep things simple I really want to use only one mesh for the board and not a set of "tiles". I have no idea how to best achieve this.
My first thought was to use multitexturing but that would be completely inefficient and has extreme limitations. What I think needs to be achieved is to paint or stamp each little square onto the mesh texture at run time. Am I on the right track here?
The code is rather long and complex but starts off by creating a mesh, a surface and 4 vertices at 0,0,0 + 100,0,0 + 100,0,100 + 0,0,100 linked to the surface. I then connect the vertices to create two triangles from v0+v1+v2 and v0+v2+v3. I then color the mesh white.
Next I clear the textureflags and load a 16x16 UV clamped texture which is completely red (one square). I then scale the texture by .10, .10. Finally I texture the board mesh on texture layer 2 and position the UV on the texture so the square appears where I need it.
All thoughts and comments appreciated!
-- X2