## It sucks, but it's a start

posted in Lame? Where?!
Published August 15, 2006
Advertisement


I need to figure out how to calculate normals for this... and when i look at it in wireframe mode, i get weird effects. Not sure why, maybe it's normal. Here's what wireframe looks like.....



I colored the weird lines. They go from the rightmost vertex to the leftmost vertex on the next row... i'm not sure if that's working as intended or not. I'm using a triangle strip to render the terrain, so I dunno. I'll look into it.
Previous Entry ## Rock, Paper, Scissors
Next Entry ## gogo rav!
0 likes 4 comments

Comments

Wyzfen
Yup, thats right for a triangle strip.
A triangle strip uses 3 consecutive points - so when you wrap the line, it uses the two points from the last triangle (on the left) and the new one on the right.

To fix it, you'd usually make a 'degenerate triangle' - one where two of the points coincide - so, once you finish a row, repeat the last point of the last triangle before starting the next row.

(Actually, i'm surprised it only shows up in wireframe mode - are you doing anything different for that other than just setting the render state to wireframe ?)

Wyzfen
August 15, 2006 03:29 AM
Evil Steve
As Wyzfen said, that looks right. Do you disable culling when you render in wireframe? That would explain why the lines only show in wireframe mode.

Also, in D3D (I assume OpenGL too), indexed triangle lists are generally more efficient than triangle strips (And often easier to deal with). There might not be a huge amount in it, but it's something to be aware of.
August 15, 2006 07:11 AM
Laz
No, doing nothing different. For quick wireframe all I did was glPolygonMode(GL_FRONT_AND_BACK, FL_LINE); ... does the same thing if I use a line strip instead of a triangle strip.

Quote:To fix it, you'd usually make a 'degenerate triangle' - one where two of the points coincide - so, once you finish a row, repeat the last point of the last triangle before starting the next row.


Yep, doing that =)

Thanks for the replies, yeah i know that a triangle strip involved pretty much plotting the first vertex and the last vertex of each row twice, I just wasn't sure if the lines from right to left were normal in line mode, and if so, how to make them not show up.
August 15, 2006 09:41 AM
Wyzfen
Ah, so you're using a line-strip using the same buffer as the triangle strip, rather than just putting it in wireframe mode ?
The error makes sense then - I'd expect extra lines using a line strip - since the degenerate points will make that pair not draw, but wont fix the next line (left-to-right).

I dont use openGL - is there a way of setting the renderstate to wireframe, rather than just using a line-strip ?

Wyzfen
August 16, 2006 04:37 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Math is hard

1242 views

## uhh

1441 views

## lol

1190 views

## new gaem?!

1130 views

## GH Tourney

1258 views

## Guitar Hero

1203 views

## Beyond Hell

1177 views
Advertisement