• Advertisement
Sign in to follow this  
  • entries
    198
  • comments
    445
  • views
    83279

## It sucks, but it's a start

Sign in to follow this  

411 views



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.
Sign in to follow this  


4 Comments


Recommended Comments

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

Share this comment


Link to comment
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.

Share this comment


Link to comment
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.

Share this comment


Link to comment
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

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement