Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualKaptein

Posted 07 November 2012 - 08:33 AM

your understanding is correct
you can:
1. position vertices so that you only need 1 (or 2) matrices to determine their position in space
basically, if you have no choice but to transform them each frame, you can use the animation approach:
use a dynamic VBO, and transform each vertex each frame, and render everything in one go
this is a reasonable approach in many cases

2. use several draw calls: use one matrix that you translate back and forth, draw a range of vertices at a time
glDrawArrays takes 3 parameters: type, first, and count
so you would use the first parameter, and start with 0, then jump to say 4, 8, 12, 16.. if you only draw 1 box at a time
this is very slow though, so if you can, draw 100 boxes at a time :)

i use both, since if you have alot of vertices it may not be in your best interest to transform all of them each frame
instead using a few extra calls on groups of vertices that belong together is better
but it depends on your data
i'm sure other people can name other solutions, but as long as your boxes don't move, you should be able to do one or the other without problem

#1Kaptein

Posted 07 November 2012 - 08:31 AM

your understanding is correct
you can:
1. position vertices so that you only need 1 (or 2) matrices to determine their position in space
2. use several draw calls: use one matrix that you translate back and forth, draw a range of vertices at a time

i use both, since if you have alot of vertices it may not be in your best interest to transform all of them each frame
instead using a few extra calls on groups of vertices that belong together is better
but it depends on your data
i'm sure other people can name other solutions, but as long as your boxes don't move, you should be able to do one or the other without problem

PARTNERS