PDA

View Full Version : Triangle Lists



Meanz
02-28-2012, 10:23 PM
I am encountering a weird problem.
I am drawing triangles with triangle list, my goal is to create some sort of terrain.

I have divided the terrain into squares, each square having four corners, thus four slope points.
The map is basically a grid. To simulate height I set for example the bottom right corner of a tile to have an Y value of 0.6 while the adjacent tile then have a bottom left corner of 0.6
And so they form a kind of spike. And thus simulating an easy concept of terrain I guess.

But to make things easier, I have separated my terrain into areas giving one area 16x16 tiles, so instead of a big vertex buffer I have one vertex buffer per 16x16 tiles.

This is where my problem occur, for some reason the tiles in the next area doesn't fit my last area, even though the y values are the same.

Here is a picture between a crossing of four different areas, showing the error. I did the numbers, they are all right. This is some peculiar stuff I don't understand yet.

Image Example http://bildr.no/thumb/1119938.jpeg (http://bildr.no/view/1119938)

Oh and wireframe, It's not from the same area though, but it's from four areas meeting.

Wireframe (http://bildr.no/view/1119939)

ZbuffeR
02-29-2012, 02:35 AM
I was expecting some precision issue that could be caused by some distant transformation loosing precision in floats, but rather it looks like edge values are completely different !

Try with 1x1 tiles, then 2x2 tiles, printf all the values, verify tiles are not rotated 90 or 180, check how you fill and read the vertex buffers, etc.

Meanz
03-01-2012, 12:07 PM
Again, I verified the numbers already.
So if you're saying triangle lists are not the cause of this, then I screwed something else up.

Anyways that was a confirmation so I can narrow it down ^^

Thanks ;=)