SameBoy/Cocoa/GBViewGL.m

36 lines
875 B
Mathematica
Raw Normal View History

#import "GBViewGL.h"
#import "GBOpenGLView.h"
@implementation GBViewGL
- (void)createInternalView
{
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion3_2Core,
0
};
NSOpenGLPixelFormat *pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
assert(pf);
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil];
self.internalView = [[GBOpenGLView alloc] initWithFrame:self.frame pixelFormat:pf];
2021-10-23 10:36:58 +00:00
((GBOpenGLView *)self.internalView).wantsBestResolutionOpenGLSurface = true;
((GBOpenGLView *)self.internalView).openGLContext = context;
}
- (void)flip
{
[super flip];
dispatch_async(dispatch_get_main_queue(), ^{
2021-10-23 10:36:58 +00:00
[self.internalView setNeedsDisplay:true];
[self setNeedsDisplay:true];
});
}
@end