annotate src/video/uikit/SDL_uikitopengles.m @ 2431:7e449145b6ca gsoc2008_iphone

Added some code to set proper screensize on iPhone
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Fri, 15 Aug 2008 00:56:43 +0000
parents d92493ff1b51
children bf7028ffbf07
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
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 {
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 /* 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
65 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
66 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
67 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
68 }
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 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
70 }
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
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 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
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
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
76 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
77
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
78 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
79 return;
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
80 }
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
81 [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
82 /* 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
83 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
84 [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
85
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 /* 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
87 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
88
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
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_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
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
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
94 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
95
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
96 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
97
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
106 view.multipleTouchEnabled = YES;
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
107
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
108 data->view = view;
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
109
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
110 [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
111
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
112 /* 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
113 [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
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 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
116 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
117 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
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
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
120 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
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
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 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
124 {
2402
1fe89198aba5 removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2350
diff changeset
125 /* 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
126 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
127 /* 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
128 [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
129
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
130 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
131 }
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
132
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