
Advertisement
This topic is 375 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.
If you intended to correct an error in the post then please contact us.
Recommended Posts
GoliathForge 2315
If indexed draw, the glDrawElements call would be used to fire the render. I'm looking at the third parameter calculation in the glDrawArrays call as the bad guy, as a guess because it seems way too many for triangle strip.
Edit: looks like you're not building your triangle strip properly. Graph what you're doing on paper of what your double for loop does. When the loop starts, the first two triangles are correct. At the second iteration the first and second triangles are degenerate then the third and fourth fill the grid location hiding the problem. The error is repeated to the end. When a grid like this is built using triangle strip, a degenerate triangle is needed when you complete building a row and advance to the next row then repeat.
Edited by GoliathForge
Came back after work to look proper.
MaimaVanPersie 133
Thank you both for your reply.
On 9/29/2017 at 1:09 AM, lawnjelly said:Edit .. Ah no I think I see it ... you are using triangle strip, are you using an index buffer too? You need to reset the triangle strip after each row with a degenerate triangle or something like that.
I'm not using an index buffer to draw my triangles, how do I reset the triangle strip after each row?
MaimaVanPersie 133
Okay, problem fixed (FINALY!!!). Thank you so much for the help guys. Here's what I did for anyone interested, I stopped using triangle strips and I used indices instead with GL_TRIANGLES. That fixed the problem. I'm really glad I fixed this, for whoever encounters this problem and somehow stumbles upon this thread in the future, there were numerous solutions I researched to fixing this issue, I simply chose the indices/triangle approach as it seemed simple, but I will leave links for you here:
https://gamedev.stackexchange.com/questions/143448/opentkterraintrianglestripissue (< This is basically my problem)
https://www.opengl.org/discussion_boards/archive/index.php/t177729.html
The problem is really mentioned by the users above. I am very thankful for your help guys!
galop1n 1044
15 hours ago, MaimaVanPersie said:Okay, problem fixed (FINALY!!!). Thank you so much for the help guys. Here's what I did for anyone interested, I stopped using triangle strips and I used indices instead with GL_TRIANGLES. That fixed the problem. I'm really glad I fixed this, for whoever encounters this problem and somehow stumbles upon this thread in the future, there were numerous solutions I researched to fixing this issue, I simply chose the indices/triangle approach as it seemed simple, but I will leave links for you here:
https://gamedev.stackexchange.com/questions/143448/opentkterraintrianglestripissue (< This is basically my problem)
https://www.opengl.org/discussion_boards/archive/index.php/t177729.html
The problem is really mentioned by the users above. I am very thankful for your help guys!
The indexed triangle list is indeed the right thing to use, but you need to generate a proper triangle index ordering or your GPU will have very poor cache utilization. There is many tool and algo to optimize this NP complete problem, one i like is this one : https://tomforsyth1000.github.io/papers/fast_vert_cache_opt.html

Advertisement
Only had a very brief look, but wild guess, off by one error? i.e. to make a fence 10 metres long with fenceposts every 1 metre, you need 11 fenceposts, not 10...
Edit .. Ah no I think I see it ... you are using triangle strip, are you using an index buffer too? You need to reset the triangle strip after each row with a degenerate triangle or something like that.
Edited by lawnjellyShare this post
Link to post
Share on other sites