setCartoonInk on OSX

Hello, I’ve a problem with setCartoonInk on OSX. I’ve a MacMini (the graphic card is a nVidia 9400M).

When I run the cartoon example provided with Panda, sometimes I get the correct visualization (number 1), but sometimes (yes, sometimes, it happens apparently randomly) I get the visualization number 2 (I report both for comparison):

These are the logs:
(1: the execution that works)

DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Thu Jul 15 19:34:26 Mac-mini-di-.local ppython[203] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Thu Jul 15 19:34:26 Mac-mini-di-.local ppython[203] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Thu Jul 15 19:34:49 Mac-mini-di-.local ppython[203] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 25
Thu Jul 15 19:34:49 Mac-mini-di-.local ppython[203] <Error>: kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x19

(2: the execution that doesn’t work)

DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Thu Jul 15 19:33:46 Mac-mini-di-.local ppython[197] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Thu Jul 15 19:33:46 Mac-mini-di-.local ppython[197] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
:display:gsg:glgsg(error): Could not load Cg fragment program:created-shader (arbfp1 Error on line 2: unrecognised option (hint: 'ATI_draw_buffers'))
:display:gsg:glgsg(error): at 384 of panda/src/glstuff/glShaderContext_src.cxx : GL error 1282
Thu Jul 15 19:34:24 Mac-mini-di-.local ppython[197] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 18
Thu Jul 15 19:34:24 Mac-mini-di-.local ppython[197] <Error>: kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x12

I tried to make the problem reproducible (really the process was the reverse: I saw the problem in my application, and trying to isolate it I fell in the example problem), and I built an example that reproduce the problem with more likelihood (with the cartoon example it happens rarely, but with the following it happens almost at every execution). The problem seems related: it produces same error messages and it happens only with setCartoonInk.

I have this program (here the files needed):

def setupCartoonInk():
  from direct.filter.CommonFilters import CommonFilters
  if CommonFilters( base.win, base.cam ).setCartoonInk( separation = 1 ) == False:
    print( 'Video card not powerful enough to do image postprocessing.' )
    
def setupCubes():
  from panda3d.core import TextureStage
  for i in range( 5 ):
    for j in range( 5 ):
      box = loader.loadModel( 'cube' )
      box.setPos( i * 2.5, j * 2.5, 0 )
      box.reparentTo( render )
      box.setShaderAuto()
      ts = TextureStage( 'ts' )
      box.setTexture( ts, loader.loadTexture( 'texture.jpg' ) )

def setAmbientLight():
  from pandac.PandaModules import AmbientLight
  alight = AmbientLight( 'alight' )
  alight.setColor( ( .7, .7, .7, 1 ) )
  render.setLight( render.attachNewNode( alight ) )

import direct.directbase.DirectStart
base.camera.setPos( 5, -8, 18 )
base.camera.lookAt( 5, 4, 0 )
base.disableMouse()
setupCartoonInk()
setupCubes()
setAmbientLight()
run()

In Windows and Linux (both tested), every time I launch it I obtain this (expected) behaviour.

But, when I run on Mac, I obtain a different behaviour at every execution. These are three consecutive executions:

As you can see, I obtain (pseudorandomly) some black cubes. This is the log of the last execution:

DirectStart: Starting the game.
Known pipe types:
  osxGraphicsPipe
(all display modules loaded.)
Thu Jul 15 19:05:37 Mac-mini-di-.local ppython[802] <Error>: kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Thu Jul 15 19:05:37 Mac-mini-di-.local ppython[802] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
:display:gsg:glgsg(error): Could not load Cg fragment program:created-shader (arbfp1 Error on line 2: unrecognised option (hint: 'ATI_draw_buffers'))
:display:gsg:glgsg(error): at 384 of panda/src/glstuff/glShaderContext_src.cxx : GL error 1282
:display:gsg:glgsg(error): Could not load Cg fragment program:created-shader (arbfp1 Error on line 2: unrecognised option (hint: 'ATI_draw_buffers'))
:display:gsg:glgsg(error): at 384 of panda/src/glstuff/glShaderContext_src.cxx : GL error 1282

How can I get rid off these black cubes? Very thanks!

Hmm, I think this might be a bug that we fixed recently. The fix may not be part of 1.7.0, but it should be visible on the nightly build. Can you try installing that version to see if it still persists there?

David

Thanks! I would try, but I have a very noobish question. :blush:
What is the “correct” procedure to remove the current Panda installation in OSX? Very thanks!

I believe you only have to remove /Developer/Panda3D.

David

Ok! I removed /Developer/Panda3D, I installed the actual daily build, I launched the cartoon example and I got exactly this output. Is it a known issue?

Hm. That does indeed sound like trouble.

Confirmed, I see this problem too. I will continue to investigate.

David

Hello yaio,
By any chance, did you try to run the bloom effect and get some weird white lines on top and right of the screen ?

This bug?
bugs.launchpad.net/panda3d/+bug/424640

There is a workaround there too.

Thanks Craig, it’s the bug I’m facing since many days!
I’ll try the power of 2 resize window solution tomorrow.

Anyhow, yes, I see them…

Hello, now nightly builds work (very thanks!), and so I can try it. But, when I launch the Panda’s Cartoon Shader example, I get only a window with: “Toon Shader: Video driver reports that shaders are not supported.”

The machine is a MacMini (2009) with 9400M. Is it expected that on 9400M the Cartoon Shader example of Panda doesn’t work? Thanks!