osx-crash when activating antialiasing

i am trying to activate antialiasing under osx, however i get a crash when i try to activate setup the multisamples:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'framebuffer-multisample 1' )
loadPrcFileData('', 'multisamples 8')

from direct.directbase import DirectStart

a = loader.loadModel( 'test.egg' )
a.reparentTo( render )

from pandac.PandaModules import *

MODEL_ANTIALIAS = AntialiasAttrib.MAuto | AntialiasAttrib.MBetter
render.setAntialias(MODEL_ANTIALIAS)

run()

without the loadprc-commands, it doesnt crash, but antialias doesnt work. Afaik those commands are required to have antialiasing.

this bug doesnt seem to be fixed in the latest dev-versions.

Process:         Python [6979]
Path:            /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Identifier:      org.python.pythonapp
Version:         2.5.0 (2.5.0a0)
Build Info:      python-300000~42
Code Type:       X86 (Native)
Parent Process:  bash [6206]

Date/Time:       2008-09-17 15:39:21.699 +0200
OS Version:      Mac OS X 10.5.4 (9E17)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.opengl              	0x96675b93 CGLDescribePixelFormat + 83
1   com.apple.agl                 	0x9213c009 aglDevicesOfPixelFormat + 132
2   libosxdisplay.dylib           	0x049c4095 osxGraphicsStateGuardian::describe_pixel_format(FrameBufferProperties&) + 693
3   libosxdisplay.dylib           	0x049c4a2b osxGraphicsStateGuardian::buildGL(osxGraphicsWindow&, bool, FrameBufferProperties&) + 1323
4   libosxdisplay.dylib           	0x049ba962 osxGraphicsWindow::buildGL(bool) + 114
5   libosxdisplay.dylib           	0x049be6f9 osxGraphicsWindow::OSOpenWindow(WindowProperties&) + 633
6   libosxdisplay.dylib           	0x049bffa8 osxGraphicsWindow::open_window() + 312
7   libdisplay.dylib              	0x01e71589 GraphicsWindow::set_properties_now(WindowProperties&) + 121
8   libosxdisplay.dylib           	0x049bf1ba osxGraphicsWindow::set_properties_now(WindowProperties&) + 58
9   libdisplay.dylib              	0x01e7104e GraphicsWindow::process_events() + 158
10  libosxdisplay.dylib           	0x049b859a osxGraphicsWindow::process_events() + 26
11  libdisplay.dylib              	0x01e22f5c GraphicsEngine::process_events(ov_set<PointerTo<GraphicsOutput>, IndirectLess<GraphicsOutput> > const&, Thread*) + 44
12  libdisplay.dylib              	0x01e24a83 GraphicsEngine::WindowRenderer::do_windows(GraphicsEngine*, Thread*) + 67
13  libdisplay.dylib              	0x01e30cd8 GraphicsEngine::open_windows() + 104
14  libdisplay.dylib              	0x01e393ed GraphicsEngine::make_output(GraphicsPipe*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, FrameBufferProperties const&, WindowProperties const&, int, GraphicsStateGuardian*, GraphicsOutput*) + 925
15  libdisplay.dylib              	0x01eac5f6 Dtool_GraphicsEngine_make_output_436(_object*, _object*, _object*) + 1078
...

Some more info’s i’ve found:

the last panda call seems to be a deprecated call (since 10.5):
http://developer.apple.com/documentation/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/c/func/aglDisplaysOfPixelFormat
aglDevicesOfPixelFormat is replaced by aglDisplaysOfPixelFormat

some techinfo’s on the change:
http://developer.apple.com/qa/qa2007/qa1523.html

Nearly all of the calls in osxdisplay are deprecated. But that shouldn’t matter. Does your graphics card support multisampling?

We have had to use deprecated and undocumented function calls, since the new, blessed replacement functions don’t appear to be general enough to open a window and create a graphics context on it, from within a Python process.

(If anyone with lots of Apple experience can find a better way, I’d love to hear about it.)

I’m not sure about the multisample crash. I don’t get a crash per se, but I do get this in pview:

:display(error): Could not get requested FrameBufferProperties; abandoning window.
  requested: depth_bits=1 alpha_bits=8 stencil_bits=8 multisamples=1 back_buffers=1 force_hardware=1
  got: depth_bits=24 color_bits=24 alpha_bits=8 stencil_bits=8 back_buffers=1 force_hardware=1
:display: Closing osxGraphicsWindow

And this in DirectBase:

:display(warning): FrameBufferProperties available less than requested.

Both of these are expected, since my graphics card doesn’t support multisamples.

Is it possible your graphics driver has a bug which is causing the crash when you request multisamples? Or is it something Panda is doing wrong in your case?

David

One thing i am yet sure about is the following call a error handling should be made:

in panda/src/osxdisplay/osxGraphicsStateGuardian.cxx:

  GLint ndevs;
  AGLDevice *gdevs = aglDisplaysOfPixelFormat(_aglPixFmt, &ndevs);
  if (gdevs != (AGLDevice *)NULL) {

from http://developer.apple.com/documentation/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/c/func/aglDisplaysOfPixelFormat:

(sorry i’m not good enougth in c to make a patch)

drwr: maybe it doesnt crash for you because multisampling is not supported on your system?

i am pretty sure that my graphics card is able to do multisampling (RadeonX1600 on MacBook Pro) using 10.5.4.
i also get this when i set “notify-level-display debug” in the .prc

however whatever i set as “multisamples X” in the config.prc (except 0) it crashes.

the full output of running pview with display on debug: