Mercurial > sdl-ios-xcode
annotate src/video/uikit/SDL_uikitopengles.m @ 2402:1fe89198aba5 gsoc2008_iphone
removed references to singletons, now uses SDL_WindowData information instead.
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Tue, 22 Jul 2008 23:03:51 +0000 |
parents | eb828d6c3efb |
children | e9a1eed243c9 |
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 /* |
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
|
2 * SDL_uikitopengles.c |
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
|
3 * iPodSDL |
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
|
4 * |
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
|
5 * Created by Holmes Futrell on 5/29/08. |
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
|
6 * Copyright 2008 __MyCompanyName__. All rights reserved. |
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
|
7 * |
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
|
8 */ |
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
|
9 |
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
|
10 #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
|
11 #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
|
12 #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
|
13 #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
|
14 #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
|
15 #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
|
16 #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
|
17 #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
|
18 |
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
|
19 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
|
20 |
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 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
|
22 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
|
23 { |
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 /* 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
|
25 -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
|
26 -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
|
27 */ |
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 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
|
29 } |
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 |
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 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
|
32 { |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
33 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
34 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
|
35 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
36 [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
|
37 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
|
38 } |
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 |
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 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
|
41 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
|
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 /* 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
|
44 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
|
45 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
|
46 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
|
47 } |
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 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
|
49 } |
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 |
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 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
|
53 { |
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 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
55 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
|
56 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
57 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
|
58 return; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
59 } |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
60 [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
|
61 /* 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
|
62 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
|
63 [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
|
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 /* 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
|
66 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
|
67 |
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 |
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_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
|
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 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
73 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
|
74 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
75 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
|
76 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
85 view.multipleTouchEnabled = YES; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
86 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
87 data->view = view; |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
88 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
89 [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
|
90 |
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
91 /* 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
|
92 [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
|
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 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
|
95 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
|
96 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
|
97 } |
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
|
98 |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
99 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
|
100 } |
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
|
101 |
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
|
102 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
|
103 { |
2402
1fe89198aba5
removed references to singletons, now uses SDL_WindowData information instead.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2350
diff
changeset
|
104 /* 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
|
105 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
|
106 /* 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
|
107 [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
|
108 |
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; |
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 |
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
|
112 |