Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 312231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:59:50+00:00 2026-05-12T07:59:50+00:00

I have an OpenGL application which implements navigation functions such as Orbit, Walk, Pan,

  • 0

I have an OpenGL application which implements navigation functions such as Orbit, Walk, Pan, Rotate, etc. for navigating a 3D environment. All this works flawlessly and is fairly straighforward to set up using gluPerspective and gluLookAt.

glMatrixMode GL_PROJECTION
   glLoadIdentity
   gluPerspective m_ViewAngle, m_AspectRatio, m_ClipDistance_Near, m_ClipDistance_Far          

   glMatrixMode GL_MODELVIEW
   glLoadIdentity
   gluLookAt m_Eye.X, m_Eye.Y, m_Eye.Z, m_Focus.X, m_Focus.Y, m_Focus.Z, m_ViewUP.X, m_ViewUP.Y, m_ViewUP.Z

   glCallList DisplayListIndex

Similar to a typical ZoomExtents or ZoomToFit command in CAD software, from any arbitrary viewpoint (view direction), I would like to be able to zoom so that
(1) The entire 3D environment is visible, and
(2) The 3D environment model fills the entire viewport (is as large as possible given the current size of the viewport).

I know the bounding box (extents) of the environment (min XYZ, max XYZ). However, I have been unable to derive what the Eye and Focus positions should be for the given ViewAngle and AspectRatio and environment extents.

Perhaps there’s an easier way to accomplish this, than with gluLookAt. Any help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:59:50+00:00Added an answer on May 12, 2026 at 7:59 am

    Actually it can be done much ‘easier’.

    What you need to do is a projection of your model to a plane. Then, determine the highest and lowest points (top y, bottom y, leftmost x, rightmost x), and finally determine how much scaling you need to fit this rectangle in the rectangle you’d actually need.

    The plane you need to project on is the screen plane.

    Luckily for you, you are already doing this.

    So, transform every point of your model using the matrices you already have set, and determine the maximum points.

    Calculate how much scaling you’d need to fit it on the screen. And apply this scaling to the zoom of the object

    Thats it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple iPhone application which uses OpenGL ES (v1) to draw a
We have a windows mobile 6.5 gaming application which uses openGL . Now we
Friends,I want to work on a OpenGL application, in which i have to develop
I have a simple OpenGL application, which displays a line. I store x1, y1,
Okay, so here's the situation: I have an application which uses SDL and OpenGL.
I have a win32 application, in which I want to use openGL just for
I have a simple OpenGL application where I have 2 objects displayed on screen:
I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have
I have an application with an OpenGL window as a child window of the
I have an application that is built against OpenSceneGraph (2.6.1) and therefore indirectly OpenGL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.