Dynamically setting screen size requirements

Greetings!

For one of our remote testers, we’re seeing the following error:

Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
:display:windisplay(error): Videocard has no supported display resolutions at specified res (1024 x 768 x 32)
:display:wgldisplay(error): Could not create GL context.
Assertion failed: context at line 175 of c:\temp\mkpr\panda3d-1.2.3\panda\src\wgldisplay\wglGraphicsWindow.cxx
Assertion failed: context at line 175 of c:\temp\mkpr\panda3d-1.2.3\panda\src\wgldisplay\wglGraphicsWindow.cxx
Traceback (most recent call last):
  File "<string>", line 28, in ?
  File "C:\Panda3D-1.2.3\direct\src\directbase\DirectStart.py", line 4, in ?
  File "C:\Panda3D-1.2.3\direct\src\showbase\ShowBase.py", line 192, in __init__
  File "C:\Panda3D-1.2.3\direct\src\showbase\ShowBase.py", line 501, in openDefaultWindow
  File "C:\Panda3D-1.2.3\direct\src\showbase\ShowBase.py", line 562, in openMainWindow
  File "C:\Panda3D-1.2.3\direct\src\showbase\ShowBase.py", line 425, in openWindow
AssertionError: context at line 175 of c:\temp\mkpr\panda3d-1.2.3\panda\src\wgldisplay\wglGraphicsWindow.cxx

We have set the win-size parameter to “1024 768,” and requested fullscreen, so I suspect that we may be exceeding the maximum resolution of the graphics card.

Is there any way in Panda3D to request all of the sizes that the graphics card can provide? Once we find one we’re happy with, how do we set the win-size property? I’m a little stumped because when I access the win-size property via ConfigVariableInt, I can see its components using the [] operator, but I can’t set them using the setValue operator.

Take care,
Mark

It’s an unfortunate weakness of Panda that we don’t really provide a good way to ask what screen resolutions are available. In fact, OpenGL doesn’t really provide a good way to ask what screen resolutions are available (although DirectX does).

One thing you can try is:
pick-best-screenres 1

This only works in dx8 or dx9 mode, and it’s supposed to ask Panda to make its own decision what the best resolution would be for your card. I don’t find it works that well, though.

Another option is to arbitrarily start your application at some size that you can be confident that every card will support (like 640x480), and provide an in-game option so your users can increase the screen resolution if they choose.

As to setting a particular screen resolution in-game: you can do this with the win-size config variable; you would do var.setWord(0, 640); var.setWord(1, 480), for instance. Or you could just do var.setStringValue(“640 480”).

That makes sense for controlling the size of the one window your application will ever open. But if you want to close the window and open a new one via base.openWindow(), you may be better off using the WindowProperties structure to specify the size, rather than specifying a size via the win-size config variable.

David

Hm. We just got feedback from our tester today, and it seems that bumping the screen resolution to 640x480 didn’t solve the problem shown in the exception above. Any suggestions as to what else could cause that exception? Is there any way to get more detailed information on why the OpenGL context could not be created?

According to System Information, our tester has a RADEON x300/x550 series card, which is being serviced by the driver at c:\windows\system32\drivers\ati2mtag.sys.

Thank you for your help!
-Mark

Ask your tester to try changing his desktop mode from 32-bit color to 24-bit or 16-bit color.

David