Re: ScreenSaverView
Re: ScreenSaverView
- Subject: Re: ScreenSaverView
- From: Dylan Neild <email@hidden>
- Date: Tue, 24 Sep 2002 16:09:08 -0400
Hey,
Many thanks.. this is exactly what I was looking for. :)
Dylan
On Tuesday, September 24, 2002, at 03:41 PM, Christopher Holland wrote:
We use the following in the Fluid screensaver (always open to
improvements though):
Each OpenGLView will get an initWithFrame call. This is normal, as you
have noted.
So, the problem is that it is trying to draw to 2 or more screens at
one time (I am guessing that it is a synching issue for the
contexts...but I have not idea really, it is in Apple's code) and is
slowing down.
So, to fix this:
In your startAnimation: method check to see if it is the main screen
or not and clear the screens that are not the main. This method gets
called only once at the start of the screensaver (and on resets, I
think. Can't remember off the top of my head):
if (mainDisplayOnly)
{
if ([[self window] screen] != [NSScreen mainScreen])
{
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
[[opengl openGLContext] flushBuffer];
return;
}
}
Now, in animateOneFrame: you will check to see what screen your are on
before you call the OpenGL routines...if it is a secondary screen then
just return without spending any more time in the method:
if (mainDisplayOnly)
{
if ([[self window] screen] != [NSScreen mainScreen])
return;
}
I hope this helps.
Christopher Holland
http://www.concepthouse.com/
On Monday, September 23, 2002, at 04:10 PM, Dylan Neild wrote:
Hey Everyone,
This is a Cocoa ScreenSaverView / OpenGL question.
Currently, I'm implementing, obviously, initWithFrame in my
ScreenSaverView object (called MyView).
This object takes the incoming frame, provides to it a newly
instantiated NSOpenGLView object, and then initialized OpenGL.
Trouble is, if there is more then one monitor on the system, I get
multiple calls to initWithFrame and the whole system goes to crap
performance wise because I'm now drawing a very CPU intensive screen
saver to 3 monitors instead of just the main one.
How can I use initWithFrame's arguments, or other system calls, to
determine if I should/should not draw to a specific display? Ideally,
the other displays should darken to black as normal, and only the
main should draw.
Thanks,
Dylan
_______________________________________________
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.
_______________________________________________
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.