11bd1eac4faf162e8d1bd5e9063deaee398499f1
1 /*
2 Copyright (C) 2007-2009 Olli Hinkka
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <dlfcn.h>
27 //#include <cutils/log.h>
34 #define DEBUG_NANO 0
36 #ifdef __ANDROID__
37 #include <android/log.h>
38 #define LOG __android_log_print
40 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
41 #define LOGD(...) if (DEBUG_NANO) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
42 #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,__VA_ARGS__)
43 #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG,__VA_ARGS__)
44 #else
51 #endif
54 #define GL_ENTRY(_r, _api, ...) #_api,
58 NULL
59 };
61 //const char * driver;
71 }
74 {
75 #if defined(__MULTITEXTURE_SUPPORT__)
77 {
79 }
81 {
83 }
85 {
87 }
88 #endif
90 }
92 static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void * default_func )
93 {
94 // alloc space
100 }
102 // load GL API calls
106 // nanoGL interface pointer
110 {
118 // try lib1
125 }
128 }
129 }
130 else
131 {
134 }
135 }
138 }
141 api++;
142 }
145 }
147 // Load using the dynamic loader
152 }
154 /**
155 * Init
156 */
158 {
164 // load lib
166 //LOG (ANDROID_LOG_DEBUG, LOG_TAG, "nanoGL: Init loading driver %s\n", lib1);
169 {
175 }
176 else
178 }
179 else
184 //if ( strcmp(driver, lib2) == 0 ) {
191 }
192 //}
194 // Load API gl* for 1.5+ else egl* gl*
195 //if (CreateGlEsInterface(driver, glesLib, eglLib, NULL) == -1)
197 {
198 // release lib
203 }
205 // Init nanoGL
208 }
211 {
217 }
219 // release lib
221 }