comparison src/video/android/SDL_androidgl.c @ 4707:8b109f0dcd2f

Removed old video subsystem, along with (now-unncessary) egl files.
author Paul Hunkin <paul@bieh.net>
date Fri, 18 Jun 2010 00:03:09 +1200
parents c93b44ddc63e
children 6dc26b9d8368
comparison
equal deleted inserted replaced
4706:12c9d4532b49 4707:8b109f0dcd2f
32 32
33 #include "SDL_androidvideo.h" 33 #include "SDL_androidvideo.h"
34 #include "SDL_androidevents.h" 34 #include "SDL_androidevents.h"
35 #include "SDL_androidrender.h" 35 #include "SDL_androidrender.h"
36 36
37 /* Android header */ 37 #include <android/log.h>
38 #include "egl.h"
39 38
40 39
41 //EGL globals 40 /*
42 static EGLDisplay iEglDisplay; 41 These things are in the JNI android support
43 static EGLConfig iEglConfig; 42 */
44 static EGLContext iEglContext; 43
45 static EGLSurface iEglSurface;
46
47 EGLint attribList [] =
48 {
49 EGL_BUFFER_SIZE, 16, //16 bit color
50 EGL_DEPTH_SIZE, 15,
51 EGL_NONE
52 };
53
54
55 44
56 45
57 /* GL functions */ 46 /* GL functions */
58 int Android_GL_LoadLibrary(_THIS, const char *path){ 47 int Android_GL_LoadLibrary(_THIS, const char *path){
59 printf("[STUB] GL_LoadLibrary\n"); 48 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n");
60 return 0; 49 return 0;
61 } 50 }
62 51
63 void *Android_GL_GetProcAddress(_THIS, const char *proc){ 52 void *Android_GL_GetProcAddress(_THIS, const char *proc){
64 printf("[STUB] GL_GetProcAddress\n"); 53 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n");
65 return 0; 54 return 0;
66 } 55 }
67 56
68 void Android_GL_UnloadLibrary(_THIS){ 57 void Android_GL_UnloadLibrary(_THIS){
69 printf("[STUB] GL_UnloadLibrary\n"); 58 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n");
70 } 59 }
71 60
72 /* 61 /*
73 int *Android_GL_GetVisual(_THIS, Display * display, int screen){ 62 int *Android_GL_GetVisual(_THIS, Display * display, int screen){
74 printf("[STUB] GL_GetVisual\n"); 63 __android_log_print(ANDROID_LOG_INFO, "SDL","[STUB] GL_GetVisual\n");
75 return 0; 64 return 0;
76 } 65 }
77 */ 66 */
78 67
79 SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window){ 68 SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window){
80 printf("[STUB] GL_CreateContext\n"); 69 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_CreateContext\n");
81 70 return NULL;
82 //Start up the display
83 iEglDisplay = eglGetDisplay (EGL_DEFAULT_DISPLAY);
84 if(iEglDisplay == EGL_NO_DISPLAY){
85 printf("Unable to find a suitable EGLDisplay\n");
86 return NULL;
87 }
88
89 printf("1\n");
90
91 if(!eglInitialize(iEglDisplay, 0, 0)){
92 printf("Couldn't init display\n");
93 return NULL;
94 }
95
96 printf("2\n");
97
98 EGLint numConfigs;
99
100 if(!eglChooseConfig(iEglDisplay, attribList, &iEglConfig, 1, &numConfigs)){
101 printf("Couldn't choose config\n");
102 return NULL;
103 }
104
105 printf("3\n");
106
107 iEglContext = eglCreateContext(iEglDisplay, iEglConfig, EGL_NO_CONTEXT, 0);
108
109 if(iEglContext == 0){
110 printf("Couldn't create context\n");
111 return NULL;
112 }
113
114 printf("4\n");
115
116 NativeWindowType iWindow = 1; //android_createDisplaySurface();
117
118 iEglSurface = eglCreateWindowSurface(iEglDisplay, iEglConfig, iWindow, 0);
119
120 printf("5\n");
121
122 if(iEglSurface == NULL){
123 printf("Couldn't create surface\n");
124 return NULL;
125 }
126
127 printf("6\n");
128
129 eglMakeCurrent(iEglDisplay, iEglSurface, iEglSurface, iEglContext);
130
131 printf("fininshed making context\n");
132
133 return iEglSurface;
134 } 71 }
135 72
136 int Android_GL_MakeCurrent(_THIS, SDL_Window * window, 73 int Android_GL_MakeCurrent(_THIS, SDL_Window * window,
137 SDL_GLContext context){ 74 SDL_GLContext context){
138 printf("[STUB] GL_MakeCurrent\n"); 75 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_MakeCurrent\n");
139 return 0; 76 return 0;
140 } 77 }
141 78
142 int Android_GL_SetSwapInterval(_THIS, int interval){ 79 int Android_GL_SetSwapInterval(_THIS, int interval){
143 printf("[STUB] GL_SetSwapInterval\n"); 80 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SetSwapInterval\n");
144 return 0; 81 return 0;
145 } 82 }
146 83
147 int Android_GL_GetSwapInterval(_THIS){ 84 int Android_GL_GetSwapInterval(_THIS){
148 printf("[STUB] GL_GetSwapInterval\n"); 85 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetSwapInterval\n");
149 return 0; 86 return 0;
150 } 87 }
151 88
152 void Android_GL_SwapWindow(_THIS, SDL_Window * window){ 89 void Android_GL_SwapWindow(_THIS, SDL_Window * window){
153 printf("[STUB] GL_SwapWindow\n"); 90 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SwapWindow\n");
154 } 91 }
155 92
156 void Android_GL_DeleteContext(_THIS, SDL_GLContext context){ 93 void Android_GL_DeleteContext(_THIS, SDL_GLContext context){
157 printf("[STUB] GL_DeleteContext\n"); 94 __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
158 } 95 }