diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m')
-rw-r--r-- | libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m b/libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m deleted file mode 100644 index aa6b895..0000000 --- a/libraries/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | |||
2 | #include <Cocoa/Cocoa.h> | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | static Evas_GL_Cocoa_Window *_evas_gl_cocoa_window = NULL; | ||
7 | |||
8 | @interface EvasGLView : NSOpenGLView | ||
9 | { | ||
10 | } | ||
11 | |||
12 | + (NSOpenGLPixelFormat*) basicPixelFormat; | ||
13 | - (id) initWithFrame: (NSRect) frameRect; | ||
14 | |||
15 | @end | ||
16 | |||
17 | |||
18 | @implementation EvasGLView | ||
19 | |||
20 | - (id) init | ||
21 | { | ||
22 | self = [super init]; | ||
23 | return self; | ||
24 | } | ||
25 | |||
26 | + (NSOpenGLPixelFormat*) basicPixelFormat | ||
27 | { | ||
28 | NSOpenGLPixelFormatAttribute attributes [] = { | ||
29 | NSOpenGLPFAWindow, | ||
30 | NSOpenGLPFAAccelerated, | ||
31 | NSOpenGLPFADoubleBuffer, | ||
32 | /*NSOpenGLPFAColorSize, 24, | ||
33 | NSOpenGLPFAAlphaSize, 8, | ||
34 | NSOpenGLPFADepthSize, 24,*/ | ||
35 | 0 | ||
36 | }; | ||
37 | return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; | ||
38 | } | ||
39 | |||
40 | // --------------------------------- | ||
41 | |||
42 | -(id) initWithFrame: (NSRect) frameRect | ||
43 | { | ||
44 | NSOpenGLPixelFormat * pf = [EvasGLView basicPixelFormat]; | ||
45 | self = [super initWithFrame: frameRect pixelFormat: pf]; | ||
46 | return self; | ||
47 | } | ||
48 | |||
49 | @end | ||
50 | |||
51 | |||
52 | Evas_GL_Cocoa_Window * | ||
53 | eng_window_new(void *window, | ||
54 | int w, | ||
55 | int h) | ||
56 | { | ||
57 | Evas_GL_Cocoa_Window *gw; | ||
58 | int context_attrs[3]; | ||
59 | int config_attrs[20]; | ||
60 | int major_version, minor_version; | ||
61 | int num_config; | ||
62 | |||
63 | gw = calloc(1, sizeof(Evas_GL_Cocoa_Window)); | ||
64 | if (!gw) return NULL; | ||
65 | |||
66 | _evas_gl_cocoa_window = gw; | ||
67 | gw->window = window; | ||
68 | gw->view = [[EvasGLView alloc] initWithFrame:NSMakeRect(0,0,w,h)]; | ||
69 | NSOpenGLContext *ctx = [(NSOpenGLView*)gw->view openGLContext]; | ||
70 | [ctx makeCurrentContext]; | ||
71 | gw->gl_context = evas_gl_common_context_new(); | ||
72 | |||
73 | if (!gw->gl_context) | ||
74 | { | ||
75 | free(gw); | ||
76 | return NULL; | ||
77 | } | ||
78 | evas_gl_common_context_use(gw->gl_context); | ||
79 | evas_gl_common_context_resize(gw->gl_context, w, h, 0); | ||
80 | |||
81 | return gw; | ||
82 | } | ||
83 | |||
84 | void | ||
85 | eng_window_free(Evas_GL_Cocoa_Window *gw) | ||
86 | { | ||
87 | if (gw == _evas_gl_cocoa_window) _evas_gl_cocoa_window = NULL; | ||
88 | evas_gl_common_context_free(gw->gl_context); | ||
89 | free(gw); | ||
90 | } | ||
91 | |||
92 | void | ||
93 | eng_window_use(Evas_GL_Cocoa_Window *gw) | ||
94 | { | ||
95 | if (_evas_gl_cocoa_window != gw) | ||
96 | { | ||
97 | [[(NSOpenGLView*)gw->view openGLContext] makeCurrentContext]; | ||
98 | if (_evas_gl_cocoa_window) | ||
99 | evas_gl_common_context_flush(_evas_gl_cocoa_window->gl_context); | ||
100 | _evas_gl_cocoa_window = gw; | ||
101 | |||
102 | } | ||
103 | evas_gl_common_context_use(gw->gl_context); | ||
104 | } | ||
105 | |||
106 | void | ||
107 | eng_window_swap_buffers(Evas_GL_Cocoa_Window *gw) | ||
108 | { | ||
109 | [[(NSOpenGLView*)gw->view openGLContext] flushBuffer]; | ||
110 | } | ||
111 | |||
112 | void | ||
113 | eng_window_vsync_set(int on) | ||
114 | { | ||
115 | |||
116 | } | ||
117 | |||
118 | |||
119 | void | ||
120 | eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height) | ||
121 | { | ||
122 | NSRect view_frame; | ||
123 | |||
124 | INF("Resize %d %d\n", width, height); | ||
125 | |||
126 | view_frame = [(EvasGLView*)gw->view frame]; | ||
127 | printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); | ||
128 | view_frame.size.height = height; | ||
129 | view_frame.size.width = width; | ||
130 | printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); | ||
131 | [(EvasGLView*)gw->view setFrame:view_frame]; | ||
132 | [[(NSOpenGLView*)gw->view openGLContext] flushBuffer]; | ||
133 | } | ||
134 | |||