annotate src/video/uikit/SDL_uikitopengles.m @ 2462:012d60068901 gsoc2008_iphone

updated template script
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Mon, 18 Aug 2008 18:11:47 +0000
parents bf7028ffbf07
children 058e1f140ff3
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"
2444
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
27 #include "jumphack.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
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
2416
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
44 /*
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
45 note that SDL_GL_Delete context makes it current without passing the window
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
46 */
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
47 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
48 {
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
49
2416
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
50 if (context) {
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
51 SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
52 [data->view setCurrentContext];
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
53 }
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
54 else {
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
55 [EAGLContext setCurrentContext: nil];
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
56 }
d92493ff1b51 Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2403
diff changeset
57
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
58 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
59 }
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 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
62 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
63 {
2444
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
64 /*
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
65 shouldn't be passing a path into this function
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
66 why? Because we've already loaded the library
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
67 and because the SDK forbids loading an external SO
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
68 */
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 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
70 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
71 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
72 }
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
73 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
74 }
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
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
76
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 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
78 {
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
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
80 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
81
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
82 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
83 return;
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
84 }
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
85 [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
86 /* 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
87 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
88 [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
89
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
90 /* 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
91 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
92
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
93 }
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
94
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
95 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
96 {
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
97
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
98 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
99
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
100 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
101
2444
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
102 /* construct our view, passing in SDL's OpenGL configuration data */
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
103 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
104 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
105 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
106 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
107 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
108 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
109 depthBits: _this->gl_config.depth_size];
2444
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
110
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
111 data->view = view;
2444
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
112
bf7028ffbf07 Added comments, updated included header name
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2416
diff changeset
113 /* add the view to our window */
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
114 [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
115
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
116 /* 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
117 [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
118
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
119 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
120 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
121 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
122 }
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
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
124 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
125 }
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
126
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
127 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
128 {
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
129 /* 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
130 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
131 /* 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
132 [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
133
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
134 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
135 }
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
136
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
137