File: GBViewGL.m

package info (click to toggle)
sameboy 1.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,632 kB
  • sloc: ansic: 29,954; objc: 22,249; asm: 1,424; pascal: 1,373; makefile: 1,064; xml: 111
file content (35 lines) | stat: -rw-r--r-- 875 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#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];
    ((GBOpenGLView *)self.internalView).wantsBestResolutionOpenGLSurface = true;
    ((GBOpenGLView *)self.internalView).openGLContext = context;
}

- (void)flip
{
    [super flip];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.internalView setNeedsDisplay:true];
        [self setNeedsDisplay:true];
    });
}

@end