|
tirangle strips question
when i try to create an square grid using triangle strips it doesnt come out right.
when i loop it like this
for x=0 x<100 x+=20
for y=0y<100 y+=20
draw strips
end y
end x
this pseudo code draws a bunch of squares with diagonals at each corner in the middle, and it draws it straight down.
when i swap the for loops starting with y ,
it just draws the strips horizontally as if there was no y value.
heres my code
First off, since you only specify an X and Y to define a point, you can use glVertex2f instead of glVertex3f .
You''re only drawing the upper left triangle of each grid square rather than the whole square. Now I can''t really make out your description of what''s happening, but the code says the above.
Its almost right. What you need to do is change the order in which you draw the vertices, and add one more command. Heres the total conversion:
Hope that does work; it''s off the top of my head.
You''re only drawing the upper left triangle of each grid square rather than the whole square. Now I can''t really make out your description of what''s happening, but the code says the above.
Its almost right. What you need to do is change the order in which you draw the vertices, and add one more command. Heres the total conversion:
|
Hope that does work; it''s off the top of my head.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement