Jump to content
  • Advertisement
Sign in to follow this  
BladeWise

Rendering bounding volumes

This topic is 4812 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

What is the best way to render a bounding volume? Since bounding volumes are (in most cases) rendered in wireframe I have to change the polygon mode (to GL_LINES from GL_FILL), is it better to draw them after the object they are referred to, or after all the scene has been rendered? This-pseudo code should make it clear: 1. First case for(int i=0; i<tot_objs; i++) { SetPositionAndRotation(objects); Render(objects.Mesh); glPolygonMode(GL_FRONT_AND_BACK,GL_LINES); Render(objects.Bounding); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); } 2. Second case for(int i=0; i<tot_objs; i++) { SetPositionAndRotation(objects); Render(objects.Mesh); } glPolygonMode(GL_FRONT_AND_BACK,GL_LINES); for(int i=0; i<tot_objs; i++) { SetPositionAndRotation(objects); Render(objects.Bounding); } In the first case I could avoid to set two times rotation and translation, but I need to switch polygon mode 2 times for each cycle (from FILL to LINES and back)... in the second one I could avoid overdraw (since bounding volumes will be rendered only when the scene is completely rendered) and I should switch only one time the polygon mode... so, which one is better? Are there any other solutions? Is it too costy to switch polygon mode too often?

Share this post


Link to post
Share on other sites
Advertisement
generally you render bounding volumes only for testing purposes so i don't think you should worry too much about performance..anyway, i would use the second method, i think this gives you a more clear code :)

potevo scrivertelo anche in italiano visto che sei di roma xò! cmq penso si abbastanza chiaro :)

Share this post


Link to post
Share on other sites
Ahahahaha! :D
Si, è chiarissimo anche in inglese! :P
TRANSLATION: Yes, it's clear in english too! :P

Fa piacere trovare ogni tanto qualche italiano da queste parti! ^^

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!