Re: Screen Savers and OpenGL
Re: Screen Savers and OpenGL
- Subject: Re: Screen Savers and OpenGL
- From: Eric Peyton <email@hidden>
- Date: Sun, 10 Mar 2002 08:45:50 -0600
On Sunday, March 10, 2002, at 12:45 AM, Stevos wrote:
Sounds like it would be a two part question, no? Well, it's actually 3.
1. Screensavers: What are the basics? I created one using the built in
thing, but my .h and .m files are red. And selecting them does nothing.
Red means the files are actually not in your project. Nothing will
compile ...
2. Once I can compile a screensaver, is it just a NSWindow? I am
getting the
feeling this might be easier somehow if you just make a window and have
it
sit at the screensaver level, then draw to it. But then I suppose you
wouldn't be able to make it legit or whatever.
No - if you do this you are working *way* too hard.
3. How do I get an OpenGL context in a screensaver?
Why don't you go download some of the sample code for screensavers and
start from there. It's *really* easy to do screensavers in OS X, but it
requires a little bit of setup ...
epicware provides a large number of older projects and lots of people
have released open source screensavers using the official API.
Here is an example of the simplest screensaver I can think of.
Make a cocoa bundle named MyScreenSaver. Change the extension of the
target to .saver (in the target settings).
Add the screensaver framework as a framework to the project.
Add a .h and a .m file that have the same name as the project
(MyScreenSaver).
In the .h file add, #import <ScreenSaver/ScreenSaver.h>
Change your class in the .h file to inherit from ScreenSaverView
#import <AppKit/AppKit.h>
#import <ScreenSaver/ScreenSaver.h>
@interface MyScreenSaver : ScreenSaverView
{
}
@end
In the .m file
#import "MyScreenSaver.h"
@implementation MyScreenSaver
@end
Voila - a screen saver that does nothing. NOw just overwrite the
appropriate methods from ScreenSaverView.h and your screensaver will
"just work".
If you want to do OpenGL, it's just as easy - you just add in an
OpenGLView and resize it to the full screen size, etc.
Like I said - it's real easy.
Just get some sample source. It'll save you days of thrashing in the
dark.
Eric
Thanks in advance
-Stevos
_______________________________________________
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.