• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Screen saver with shared contexts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Screen saver with shared contexts


  • Subject: Re: Screen saver with shared contexts
  • From: David Remahl <email@hidden>
  • Date: Wed, 19 Mar 2003 11:59:33 +0100

Dear list,

I am making an OpenGL screen saver which uses quite a few textures. They are generated as the saver goes along, and not all available when the saver starts. On a multiple display setup, I would like the textures to be shared by all OpenGL contexts (NSOpenGLContexts used without a mediating NSOpenGLView).

The problem is, that the ScreenSaver framework gives me few hints when it comes to what contexts are related. I need to pass the first context as the shared parameter when creating the second. What method for doing this would you suggest?

I tried storing the first context created in a static variable and using it as the shared parameter on subsequent inits, but that doesn't work as I would like it to, presumably because the preview has its own context.

Any ideas?

AFAIK, the preview is run by the System Preferences. Whereas the real screen-saver is run by LoginWindow.

So your solution may work if you just add a test in your code not to save the context in the static variable when you're in preview mode.

My $0.02

Well, the problem is a bit more complex than that...When you press Test in the screen saver preference, it is run full screen on both screens in System Preferences. I wouldn't mind having _all_ contexts shared, if there is a convenient way to do that...

Right now I found a temporary solution which involves creating a collection of contexts immediately when the module is loaded. These are then used one by one. They all share a common context, so textures created during the lifetime of one context is available for future contexts. Apparently Apple's implementation of context sharing requires all shared contexts to be created first, before they are equipped with any resources (textures, display lists).

Does anyone have an idea of how big the overhead of an unused NSOpenGLContext is? It is not connected to any drawable until used, so I would think it is pretty minor. Would keeping 25 of those around until needed be a waste? Anyone got a better idea?

/ Rgds, David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Screen saver with shared contexts (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Trapping window close event
  • Next by Date: Re: Window Sheet
  • Previous by thread: Re: Screen saver with shared contexts
  • Next by thread: Drag&Drop image to file
  • Index(es):
    • Date
    • Thread