Mercurial > sdl-ios-xcode
annotate src/video/uikit/SDL_uikitopengles.m @ 2403:e9a1eed243c9 gsoc2008_iphone
Added standard SDL header comments
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Tue, 22 Jul 2008 23:05:40 +0000 |
parents | 1fe89198aba5 |
children | d92493ff1b51 |
rev | line source |
---|---|
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
1 /* |
2403
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
4 |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
7 License as published by the Free Software Foundation; either |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
9 |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
13 Lesser General Public License for more details. |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
14 |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
18 |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
19 Sam Lantinga |
e9a1eed243c9
Added standard SDL header comments
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2402
diff
changeset
|
20 slouken@libsdl.org |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
21 */ |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
22 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
23 #include "SDL_uikitopengles.h" |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
24 #include "SDL_uikitopenglview.h" |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
25 #include "SDL_uikitappdelegate.h" |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
26 #include "SDL_uikitwindow.h" |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
27 #include "jump.h" |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
28 #include "SDL_sysvideo.h" |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
29 #include "SDL_loadso.h" |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
30 #include <dlfcn.h> |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
31 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
32 static int UIKit_GL_Initialize(_THIS); |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
33 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
34 void * |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
35 UIKit_GL_GetProcAddress(_THIS, const char *proc) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
36 { |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
37 /* Look through all SO's for the proc symbol. Here's why: |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
38 -Looking for the path to the OpenGL Library seems not to work in the iPhone Simulator. |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
39 -We don't know that the path won't change in the future. |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
40 */ |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
41 return SDL_LoadFunction(RTLD_DEFAULT, proc); |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
42 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
43 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
44 int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
45 { |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
46 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
47 SDL_WindowData *data = (SDL_WindowData *)window->driverdata; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
48 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
49 [data->view setCurrentContext]; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
50 return 0; |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
51 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
52 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
53 int |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
54 UIKit_GL_LoadLibrary(_THIS, const char *path) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
55 { |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
56 /* shouldn't be passing a path into this function */ |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
57 if (path != NULL) { |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
58 SDL_SetError("iPhone GL Load Library just here for compatibility"); |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
59 return -1; |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
60 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
61 return 0; |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
62 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
63 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
64 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
65 void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
66 { |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
67 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
68 SDL_WindowData *data = (SDL_WindowData *)window->driverdata; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
69 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
70 if (nil == data->view) { |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
71 return; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
72 } |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
73 [data->view swapBuffers]; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
74 /* since now we've got something to draw |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
75 make the window visible */ |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
76 [data->uiwindow makeKeyAndVisible]; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
77 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
78 /* we need to let the event cycle run, or the OS won't update the OpenGL view! */ |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
79 SDL_PumpEvents(); |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
80 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
81 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
82 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
83 SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
84 { |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
85 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
86 SDL_uikitopenglview *view; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
87 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
88 SDL_WindowData *data = (SDL_WindowData *)window->driverdata; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
89 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
90 view = [[SDL_uikitopenglview alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame] \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
91 retainBacking: _this->gl_config.retained_backing \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
92 rBits: _this->gl_config.red_size \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
93 gBits: _this->gl_config.green_size \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
94 bBits: _this->gl_config.blue_size \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
95 aBits: _this->gl_config.alpha_size \ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
96 depthBits: _this->gl_config.depth_size]; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
97 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
98 view.multipleTouchEnabled = YES; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
99 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
100 data->view = view; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
101 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
102 [data->uiwindow addSubview: view ]; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
103 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
104 /* Don't worry, the window retained the view */ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
105 [view release]; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
106 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
107 if ( UIKit_GL_MakeCurrent(_this, window, NULL) < 0 ) { |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
108 UIKit_GL_DeleteContext(_this, NULL); |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
109 return NULL; |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
110 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
111 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
112 return view; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
113 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
114 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
115 void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context) |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
116 { |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
117 /* the delegate has retained the view, this will release him */ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
118 SDL_uikitopenglview *view = (SDL_uikitopenglview *)context; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
119 /* this will also delete it */ |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
120 [view removeFromSuperview]; |
2350
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
121 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
122 return; |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
123 } |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
124 |
eb828d6c3efb
SDL_uikitopengles is responsible for OpenGLES related functions in the UIKit video driver. The main thing to note is UIKit_GL_CreateContext which creates an instance of the SDL_uikitopenglview class, an OpenGL ES View. Most the real functionality is in SDL_uikitopenglview.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
125 |