annotate src/video/android/SDL_androidgl.c @ 5207:daa5463466c5

Fixed building on Android, added SDL_opengles2.h, removed unnecessary SDL_glesfuncs.h
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 02:35:14 -0800
parents 327f181542f1
children c66b2a778b7e
rev   line source
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
1 /*
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
4
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
9
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
13 Lesser General Public License for more details.
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
14
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
18
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
19 Sam Lantinga
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
20 slouken@libsdl.org
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
21 */
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
22 #include "SDL_config.h"
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
23
4980
d9fdff945ec9 A bit of cleanup in the Android driver
Sam Lantinga <slouken@libsdl.org>
parents: 4959
diff changeset
24 /* Android SDL video driver implementation */
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
25
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
26 #include "SDL_video.h"
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
27
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
28 #include "SDL_androidvideo.h"
5092
327f181542f1 Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
29 #include "../../core/android/SDL_android.h"
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
30
4707
8b109f0dcd2f Removed old video subsystem, along with (now-unncessary) egl files.
Paul Hunkin <paul@bieh.net>
parents: 4703
diff changeset
31 #include <android/log.h>
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
32
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
33
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
34 /* GL functions */
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
35 int
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
36 Android_GL_LoadLibrary(_THIS, const char *path)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
37 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
38 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n");
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
39 return 0;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
40 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
41
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
42 void *
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
43 Android_GL_GetProcAddress(_THIS, const char *proc)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
44 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
45 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n");
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
46 return 0;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
47 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
48
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
49 void
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
50 Android_GL_UnloadLibrary(_THIS)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
51 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
52 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n");
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
53 }
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
54
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
55 SDL_GLContext
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
56 Android_GL_CreateContext(_THIS, SDL_Window * window)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
57 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
58 Android_JNI_CreateContext();
5207
daa5463466c5 Fixed building on Android, added SDL_opengles2.h, removed unnecessary SDL_glesfuncs.h
Sam Lantinga <slouken@libsdl.org>
parents: 5092
diff changeset
59 return (SDL_GLContext)1;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
60 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
61
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
62 int
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
63 Android_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
64 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
65 /* There's only one context, nothing to do... */
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
66 return 0;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
67 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
68
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
69 int
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
70 Android_GL_SetSwapInterval(_THIS, int interval)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
71 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
72 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SetSwapInterval\n");
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
73 return 0;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
74 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
75
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
76 int
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
77 Android_GL_GetSwapInterval(_THIS)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
78 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
79 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetSwapInterval\n");
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
80 return 0;
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
81 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
82
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
83 void
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
84 Android_GL_SwapWindow(_THIS, SDL_Window * window)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
85 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
86 Android_JNI_SwapWindow();
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
87 }
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
88
4989
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
89 void
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
90 Android_GL_DeleteContext(_THIS, SDL_GLContext context)
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
91 {
58b6bb4a45e9 More Android cleanup:
Sam Lantinga <slouken@libsdl.org>
parents: 4980
diff changeset
92 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
4701
d40bb3165d2b Added (partially implemented) android video backend and associated files needed to build
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
93 }