Code Monkey home page Code Monkey logo

Comments (6)

kamgha avatar kamgha commented on June 11, 2024

Looks like a feature, not a bug: You're using ShowBase. Have you tried base.setAspectRatio(ar) instead of manipulating the Lens directly?

Sets the global aspect ratio of the main window. Set it to None to restore automatic scaling.

I'm not sure what you'd like to do: Set the aspect ratio of the camera out of sync from the window aspect ratio? You can also remove the window-event that is being created by ShowBase and implement your own instead. https://github.com/panda3d/panda3d/blob/4c2581a4d2831eb220ab03757051dc2b372bead9/direct/src/showbase/ShowBase.py#L579C1-L579C1

from panda3d.

ArsThaumaturgis avatar ArsThaumaturgis commented on June 11, 2024

I'll note that this behaviour doesn't seem to appear for me, under Ubuntu Linux (specifically, 18.04.6); it may thus be Mac-specific. (Presuming that it doesn't appear under Windows, of course.)

from panda3d.

asmsulaiman avatar asmsulaiman commented on June 11, 2024

@kamgha What I'm trying to do is represent a real camera and do some calculations. When the FOV changes, it changes my calculations. I want the window to be an exact representation of what the camera should see.

from panda3d.

asmsulaiman avatar asmsulaiman commented on June 11, 2024

@ArsThaumaturgis Thanks for trying it on Ubuntu Linux. I'm planning to try it on windows to see if it is just a macOS problem. I'll update about this.

from panda3d.

rdb avatar rdb commented on June 11, 2024

Normally ShowBase automatically adjusts the aspect ratio on any window-event, which includes window resizing but evidently also ⌘ + Tab.

To disable the default aspect ratio adjustment:

        self.setAspectRatio(self.getAspectRatio())

Or maybe:

    def adjustWindowAspectRatio(self, aspectRatio):
        pass

from panda3d.

kamgha avatar kamgha commented on June 11, 2024

Hi @asmsulaiman , I find your report confusing. You have now renamed it and silently altered the initial description and your code sample! You were mentioning aspect ratio at first, now you mention FOV only. I've augmented your code with the scenery from the tutorial, to see it in action:

        self.scene = self.loader.loadModel("models/environment")
        self.scene.reparentTo(self.render)
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)

On Windows, there is no visible change in FOV. Something can be observed in macOS with your code, but this is due to the window-event from ShowBase being triggered around the creation of the window on Windows (but later on macOS).

It looks like your calculation is wrong: Change to w=32 in your new/current code sample to match to the default window-size of 800x600.

from panda3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.