Window size not being set in p3d

I’ve compiled a small project of mine to p3d form, and have hit an issue: the game window opens at 640x480 (I think that it was), and only that size. I can resize the window (when I don’t set the window to be non-resizable), but it steadfastly refuses to open at any other size that I’ve found thus far

Note that when run from its Python source files the game happily opens at other sizes (and indeed does so by default).

I’ve tried setting the window size both via “loadPrcFileData” and in a prc file (which, based on other settings seeming to work, does seem to be being loaded), both to no avail. I’ve tried the p3d in both Ubuntu 13.10 and Windows XP, to similar effect.

A few things may be worth noting:

  1. I built the p3d under Ubuntu 13.10
  2. My copy of the Panda SDK is a home-built version of 1.9–as I recall, there wasn’t a pre-built version for Ubuntu 13.10 that had all of the components that I wanted at the time.
  3. The version of the run-time used for packp3d, on the other hand, is for Ubuntu “Precise”.
  4. My copy of packp3d was downloaded from runtime.panda3d.org/

What might be going wrong? Is a driver issue plausible? (I have had driver issues in both operating systems, I’m afraid.)

if you aim for windows platform, you can use ctypes to call windll.user32. SetWindowsPos(hwnd,0,x,y,sizex,sizey,0x60)
it’s reliable.

Did you try seting it befor any other imports?

 
from panda3d.core import loadPrcFileData
 loadPrcFileData('', 'win-size 1278 1024')
from panda3d.core import *

If you have a prc file -read it line by line and/or set the resolution with WindowProperties.
www.panda3d.org/forums/viewtopic.php?p=90302#p90302
The code there (be it silly) is proven to work with the default build.

Thank you both. :slight_smile:

@MichaelPanda:I’m not only aiming at Windows, I’m afraid–and in any case, surely this is something that one wouldn’t expect to call for platform-specific code? Especially given that it works when run from the Python source…

@wezu: The only things before my prc code are comments, I believe; that shouldn’t be the problem, I don’t think.

I’ve tried using “loadPrcFileData” with a hard-coded window-size (also before any importations other than those that import the prc methods), with similar results, I believe.

Having looked at the code that you linked to, I tried commenting out my prc lines and simply using WindowProperties to set the (hard-coded) window size in an init method; that, too, seems to fail.

Perhaps I should have posted this last night, but I do seem to be getting some errors (which don’t seem to appear in the Python-source version):

DirectStart: Starting the game.
Known pipe types:
  glxGraphicsPipe
(1 aux display modules not yet loaded.)
libGL error: failed to load driver: r600
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
:audio(error):   load_dso(libp3openal_audio.so) failed, will use NullAudioManager
:audio(error):     No error.
:display:gsg:glgsg(error): at 8756 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid value
:display:gsg:glgsg(error): at 8756 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid value

(My apologies for not posting this last night–I’m not sure of why I didn’t, and so will fall back on blaming tiredness. ^^; )

[edit]
I’ve just checked the log file produced under Windows, and I don’t seem to have graphics-related errors there. There are still audio errors, but I’m not terribly worried about those as the project doesn’t actually have any sound.

Put a config.prc file in the game directory, and put the window size instructions into it. It should be that simple. It should be automatically picked up by packp3d.

The errors about libGL are a bit worrying, though - if you’re using an AMD card, this may indicate that the Catalyst drivers are not properly installed or enabled.

I do have a prc file in the game directory, I believe–albeit named “game.prc” rather than “config.prc”, I think. It seems to respect some settings from that file (such as making the window non-resizable), but not the window-size setting. :confused:

Regarding the errors, what you say is entirely possible: I’ve had a terrible time with graphics drivers under Ubuntu, both on this machine and another machine that had an integrated Intel chip, as I recall. :confused:

(For example, the shadow samples don’t seem to work properly for me. For whatever reason, the shadows used by wezu in Avolition do seem to work, however.)

(My driver trouble in this case might be due to having, I think, a slightly older graphics card–an ATI Mobility Radeon HD 3650–for which I believe that support is somewhat spotty. At the least it’s working rather better than did Ubuntu’s support for that integrated Intel chip, at least in the versions of Ubuntu that I was using at the time.)

I’d like to return to this topic, if I may.

This issue seems to persist, showing up on multiple operating systems (Ubuntu, Windows 7 and Windows XP) and at least two computers.

I really am mystified: the prc file does seem to be found and at least partially respected, because at least some options seem to work, but not all do.

Another thread mentioning a similar issue was posted more recently; I decided to bump this thread rather than that as that thread had other potential muddying factors (such as uncertainty regarding the presence of the “p3d_info” file, which I think that I have observed in my p3d files).