Jump to content
  • Advertisement
Sign in to follow this  
ratchmaninov

opengl scaling

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

hi there. im in the process of creating an opengl and ive been wondering about something for the longest time. is there an optimal scaling figure to consider in opengl? for example, if i have a model which is 50x50x100, would this render slower than the same model scaled down (not with glScalef) to 10x10x20. this is taking into consideration that the same area of the model is viewed on the screen. does it really matter? is there a big difference in performance? you would think that the larger the scale the slower, but then again it might depend on what is currently being viewed on the screen. regardless, what is a good scale to use? for example, the smallest coordinate value should not exceed 2 decimal places, or no decimal places, etc. thankyou, paulm.

Share this post


Link to post
Share on other sites
Advertisement
There would probably be no difference, as the model coordinates are transformed before being rendered, and:
- The transform occurs regardless of whether you have added scaling or not
- Adding scaling does not change the time taken by the transform

As for the scale, I suggest you use a scale that's centered on 1.0 (that is, if your biggest objects are of size X, then your smaller objects should be of size 1/X ). This is however not relevant, unless there is an enormous difference in the sizes of your objects, and if this is the case you'd run into problems because of the huge range of scales, and not of the value of the scale itself.

Share this post


Link to post
Share on other sites
I have never really seen a difference because the matrix multiplication gets done either way. When you call the glScalef OpenGL adds that scaling to the currnet matrix. That is the only overhead because when you draw the vertices, they get multiplied by this matrix whether you did the scaling or not, so it doesn't matter much what value you scale by. If I'm wrong in any statement, let me know now, but this is how I have understood the 3d rendering pipeline.

Share this post


Link to post
Share on other sites
thanks for the reply guys.. one thing i forgot to mention.

when you set gluPerspective, the last parameter specifies the far plane. when you use large numbers for model coordinates and your world gets bigger, you have to make this value in gluPerspective bigger. i always thought that increasing that number means less performance. is this true?

thanks once again,
paulm.

Share this post


Link to post
Share on other sites
No, increasing the far plane distance will not reduce performance.

It will slightly reduce depth buffer accuracy, but probably not to any noticeable degree. You can in fact take the limit of the projection as the far plane goes to infinity, and keep most of the depth buffer precision. (The near plane distance is usually much more significant in terms of precision.)

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!