Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect window size returned if app is set to fullscreen #1594

Closed
MonsieurBerthier opened this issue Jan 15, 2024 · 6 comments
Closed

Incorrect window size returned if app is set to fullscreen #1594

MonsieurBerthier opened this issue Jan 15, 2024 · 6 comments

Comments

@MonsieurBerthier
Copy link

MonsieurBerthier commented Jan 15, 2024

Description

getXSize() and getXSize() return incorrect values if the PRC configuration contains fullscreen true.

Steps to Reproduce

Here is the short piece of code to shown the problem:

import panda3d.core
import direct.showbase.ShowBase

prc_config = """
win-size 1920 1080
fullscreen true
"""

class Main(direct.showbase.ShowBase.ShowBase):

    def __init__(self):

        panda3d.core.loadPrcFileData("", prc_config)

        super().__init__(self)
        print((self.win.getXSize(), self.win.getYSize()))


main = Main()
main.run()

The code above prints (640, 480).
If fullscreen false the returned window size is correct.
Everything worked fine with 1.10.13.post1 and Python 3.11.

Environment

  • Operating system: Windows 11
  • System architecture: x86 64 bits
  • Panda3D version: 1.10.14
  • Installation method: pip
  • Python version: 3.12
@rdb rdb added this to the 1.10.15 milestone Jan 23, 2024
@serkkz
Copy link
Contributor

serkkz commented Feb 23, 2024

This problem is more interesting than it seems. I'm on Windows, my display resolution is 1920 by 1080, previously before Panda3D 1.10.14 this code created a full-screen window, now only 640 by 480.

from panda3d.core import GraphicsEngine, GraphicsPipeSelection, WindowProperties, \
FrameBufferProperties, GraphicsPipe

engine = GraphicsEngine.get_global_ptr()
pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe()

win_prop = WindowProperties()
win_prop.fullscreen = True
win_prop.size = (1920, 1080)
#win_prop.size = (800, 600)

win = engine.make_output(pipe,
                         name = "window",
                         sort=0,
                         fb_prop = FrameBufferProperties(),
                         win_prop = win_prop,
                         flags = GraphicsPipe.BF_require_window)
                         

while not win.is_closed():
    win.engine.render_frame()

It is worth noting that this is not observed if the size is specified differently than that of the display.

@rdb
Copy link
Member

rdb commented Mar 1, 2024

Must be a regression in 389b24e.

Is the reported base.pipe.display_width/_height correct?

@serkkz
Copy link
Contributor

serkkz commented Mar 1, 2024

from panda3d.core import GraphicsEngine, GraphicsPipeSelection, WindowProperties, \
FrameBufferProperties, GraphicsPipe

engine = GraphicsEngine.get_global_ptr()
pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe()

win_prop = WindowProperties()
win_prop.fullscreen = True
win_prop.size = (1920, 1080)
#win_prop.size = (800, 600)

win = engine.make_output(pipe,
                         name = "window",
                         sort=0,
                         fb_prop = FrameBufferProperties(),
                         win_prop = win_prop,
                         flags = GraphicsPipe.BF_require_window)

print(pipe.display_width, pipe.display_height)
print(win.get_x_size(), win.get_y_size())

while not win.is_closed():
    win.engine.render_frame()

Output:

1920 1080
640 480

@rdb
Copy link
Member

rdb commented Apr 8, 2024

This was caused by the fix to #1469.

Could you please test the new build and let me know whether there are still problems?

http://buildbot.panda3d.org/downloads/5da013e2e9a991c993532cc6886c53e4c38bccc0/

@rdb
Copy link
Member

rdb commented Apr 13, 2024

Has anyone been able to test the changes?

@serkkz
Copy link
Contributor

serkkz commented Apr 15, 2024

This fixed the problem for me, now my window creation code above gets the size right. Thank you.

Output:

1920 1080
1920 1080

@rdb rdb closed this as completed in 2adc167 May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants