I'm stumped. I'm by no means familiar with objective-c++ or Apple's libraries, so please bear with me. My renderer code is only getting called once (when the application starts). It only gets called again if I minimize and restore the window. No idea how to make it refresh.
Code in question:
Code in question:
#import "GLView.h"
@implementation GLView
- (id)initWithFrameNSRect)frameRect
{
NSOpenGLPixelFormatAttribute attr[] =
{
NSOpenGLPFAAccelerated,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute) 32,
(NSOpenGLPixelFormatAttribute) 0
};
NSOpenGLPixelFormat *nsglFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
if (self = [super initWithFrame:frameRect pixelFormat:nsglFormat])
renderer = new Renderer();
return self;
}
- (void)dealloc
{
delete renderer;
[super dealloc];
}
- (void)prepareOpenGL
{
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 400, 300, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
}
- (void)drawRectNSRect)rect
{
renderer->DrawGL();
// DOESN'T WORK --- [super setNeedsDisplay:YES];
// DOESN'T WORK --- [self setNeedsDisplay:YES];
}
@end