OpenGL
OpenGL
- Subject: OpenGL
- From: Drew Cunningham <email@hidden>
- Date: Thu, 4 Apr 2002 15:58:13 -0500
I have subclassed NSOpenGLView and I am trying to turn on dubble
buffering
in my pixelformat.
I have read that the right place to do that is to override
initWithFrame:frameRect
But my program doesnt seem to work.
Being new to Cocoa, Obj-C _and_ OpenGL is not very promising...
I have added a bunch of NSLog's and have found out that my initWithFrame
function is not called at all. How come?
I have now used 4 days on this problem! (Guess it turns out I have
forgot
a semicolon or something like it...argh!)
I'm new to OpenGL too so I don't know how much help I'll be...
If your initWithFrame method isn't called, it might be a Interface
Builder problem. You should check to make sure you have an OpenGL view
that is set to use your custom class inside of your NIB file.
Is your "- (id)initWithFrame:(NSRect) frameRect
pixelFormat:(NSOpenGLPixelFormat*)format;" being called?
Here is a sample of code that I know to work:
- (id)initWithFrame:(NSRect) frameRect
{
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFADepthSize, 32,
nil
};
NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc]
initWithAttributes:attrs];
/* Check if initWithAttributes succeeded. */
if(pixFmt == nil) {
/* initWithAttributes failed. Try to alloc/init with a different
list of attributes. */
}
self = [super initWithFrame:frameRect pixelFormat:pixFmt];
if(!self)
NSLog(@"initWithFrame failed");
return self;
}
_______________________________________________
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.