Jump to content
  • Advertisement
Sign in to follow this  
Wizumwalt

place model in center of screen proportionately

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

If I have the models centroid, and it's min and max x, y, and z points and the size of the window ... how do I size my model on the canvas so that it takes up about 80% of the screen (as of now, it initializes on my canvas really small and I have to zoom in for about 10 seconds to see it all). If possible, I'd just like to use gluLookAt(...) and move the camera instead of glScale as I think it would be easier (at least for me). Any help much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
I'm not too familiar with OGL, but couldn't you just say:

glTranlatef(0.0f, 0.0f, /*however much you want to move the model closer to the screen*/);

?

Hope that helps.

-AJ

Share this post


Link to post
Share on other sites
Yes, I could, but ... I don't know how to compute the values so that once my model's input file is parsed and loaded, how do I compute the values to make it the exact size when it first appears? There should not have to be any zooming at this point to make it the right size. The model should just ... show up with a viewable size.

Share this post


Link to post
Share on other sites
If there should be no need for zooming, then my guess is there's something wrong with the model data. If you want it to just show up the right way with no scaling or translation, I really don't know what to say, sorry. Perhaps someone with more OGL knowledge can assist you. But I don't see what's wrong with doing a quick translation. If it looks right, it is right [smile]. Oh yeah, forgot to say in my first post, but it's cool to see another Houstonian in here. I'm originally from there, but I made the mistake of joining the Navy, lol, so now I am in Virginia. Anyway, I hope I helped you out in some small way and I hope you solve your problem.

-AJ

Share this post


Link to post
Share on other sites
If I've reasoned this out correctly, the distance you want is (radius of bounding sphere of the object) * asin((something close to, but less than 1) * (the current foveal angle)).

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!