Archived

This topic is now archived and is closed to further replies.

GekkoCube

Designing a flat plain of triangles using tri-strips.

Recommended Posts

GekkoCube    116
I want to create a flat plain that is 32x32 in vertex dimensions. Right now i can create this plain using triangle strips in this visual order: -----------> | <---------- | -----------> | <---------- ...so on and so forth. Basically it''s a top-down, left-right/right-left order. The problem with this is that i need to have the culling mode to be none since the above will only draw every other row. But i would like counterclock-wise culling. who can shine some line on this...? how can i draw CCW triangle strips for the whole plain? NOTE: Doing a top-down, and a strictly left-right ordering of each row will cause one very wide triangle to be created. This will not look good if the plain is to move (like water). This is why i am having a hard time with this. I can use any help i can get. thanks all.

Share this post


Link to post
Share on other sites
Raloth    379
If you make your first triangle CW, none of them will be culled. It may be easier just to use indexed triangle lists, since the speed you will get from using strips instead will probably not be much.

Share this post


Link to post
Share on other sites
GekkoCube    116
what do you mean the rest wont be drawn if i use CW for the first triangle?
each row in the way i set this up alternates in the drawing, CW and CCW, every other row.
so every odd row is CW.
every even row including the first row is CCW.

also, i just want to use vertex buffers and get somethign running since using index buffers is arguably more complicated.
I say it is arguably complicated because i have to worry about an algorithm that will determine and store the indices for the vertices that i will be needing for the index buffer. And since dealing with triangle strips drawing properly and its respective algorithm setup im using is giving me enough of a headache, i just want to get things done one step at a time.

But i do intend to utilize index buffers, when i need to.

Share this post


Link to post
Share on other sites
drdlord    122
had the same problem, currently using trianglelist, (keep meaning to change to indexed but havn''t done yet) the only solution I came up with using strips was add an extra triangle at the end of each row to flip the culling to the right order, this triangle can be in the wrong order as we don''t want to see it anyway, the problem is if your surface moves too much then this triangle becomes visable, (if your ends arn''t always the lowest point)

Share this post


Link to post
Share on other sites
GekkoCube    116
I eventually will use index buffers for terrain (since it would actually give me a good return in the time invested in doing it).

Since you and I are working on similar things, do you want to work together, atleast on this triangle strip thing?

i could use help getting a triangle stripped mesh to run with index buffers.

Share this post


Link to post
Share on other sites
drdlord    122
sorry currently my program isn''t running as I''m trying to get skinned meshes working, (and backed up the wrong folder that was working with static meshes...) if you can figure out why I''m getting a segfault with my skinning code at http://locker.goingplatinum.com/~drdlord/myskinning.zip then I''d be happy to take a look at indexed lists with you.

Share this post


Link to post
Share on other sites
GekkoCube    116
ok...can you tell me what i need to compile, build, and run this?

or, could u just send the project files in a zip?

im gonna take a look, but ill be learning as i go since i never had to mesh with skinned meshed.

Share this post


Link to post
Share on other sites
drdlord    122
well it was designed so you should be able to plug it into any d3d program, just give it the device and filename in the constructor to Mesh and call Mesh''s render in your render loop, (once that''s done)

but nevermind it, rendertarget helped me out got it loading the mesh, still want to get the rendering part done though... gonna be a day or two. for now make a non-indexed list and have each square be 6 vertecies, (start loops at 0, I have y on outer loop, x on inner) inside the loop make a vertex at {x, y, (groundheight)} then {x, y+1, (groundheight)} then {x+1, y, (groundheight)} then {x, y+1, (groundheight)} then {x+1, y+1, (groundheight)} then {x+1, y, (groundheight)} that should make the ground draw left to right, bottom to top, I''m using 1x1 squares

BTW I''m using dev-c++ 4.9.8.1 with directx 9.0b

Share this post


Link to post
Share on other sites