I have managed to get an NSOpenGLView subclass to work and have played around with it a bit. When I try to do the same in a new project, it doesn't work. Here is what I have done. I have a subclass of NSOpenGLView called BACubes. In interface builder, I drag an NSOpenGLView object from the palette into my window. I set its class to BACubes. Here is the code for BACubes:
BACubes.h:
BACubes.m:
I expect to see a black view screen. The console shows that drawRect has been called. Can you tell me what's wrong?
BACubes.h:
PHP:
#import <Cocoa/Cocoa.h>
@interface BACubes : NSOpenGLView {}
@end
Code:
#import "BACubes.h"
#include <OpenGL/gl.h>
@implementation BACubes
-(void)drawRect:(NSRect)rect{
NSLog(@"hey");
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
}
@end
I expect to see a black view screen. The console shows that drawRect has been called. Can you tell me what's wrong?