comparison src/video/ataricommon/SDL_atarigl.c @ 993:2662da16d668

Forgot to flush OpenGL buffer using glFinish
author Patrice Mandin <patmandin@gmail.com>
date Sat, 27 Nov 2004 21:28:49 +0000
parents 0324ce32b2d9
children 22fc5f45bbb7
comparison
equal deleted inserted replaced
992:0324ce32b2d9 993:2662da16d668
154 if (handle == NULL) { 154 if (handle == NULL) {
155 SDL_SetError("Could not load OpenGL library"); 155 SDL_SetError("Could not load OpenGL library");
156 return -1; 156 return -1;
157 } 157 }
158 158
159 this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
160 this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
161
162 if ( (this->gl_data->glGetIntegerv == NULL) ||
163 (this->gl_data->glFinish == NULL)) {
164 SDL_SetError("Could not retrieve OpenGL functions");
165 SDL_UnloadObject(handle);
166 /* Restore pointers to static library */
167 SDL_AtariGL_InitPointers(this);
168 return -1;
169 }
170
159 /* Load functions pointers (osmesa.ldg) */ 171 /* Load functions pointers (osmesa.ldg) */
160 this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt"); 172 this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt");
161 this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext"); 173 this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext");
162 this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent"); 174 this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent");
163 this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore"); 175 this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore");
164 this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress"); 176 this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress");
165 this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
166 177
167 /* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */ 178 /* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
168 this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG"); 179 this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG");
169 this->gl_data->OSMesaDestroyLDG = SDL_LoadFunction(handle, "OSMesaDestroyLDG"); 180 this->gl_data->OSMesaDestroyLDG = SDL_LoadFunction(handle, "OSMesaDestroyLDG");
170 181
172 183
173 if ( (this->gl_data->OSMesaCreateContextExt == NULL) || 184 if ( (this->gl_data->OSMesaCreateContextExt == NULL) ||
174 (this->gl_data->OSMesaDestroyContext == NULL) || 185 (this->gl_data->OSMesaDestroyContext == NULL) ||
175 (this->gl_data->OSMesaMakeCurrent == NULL) || 186 (this->gl_data->OSMesaMakeCurrent == NULL) ||
176 (this->gl_data->OSMesaPixelStore == NULL) || 187 (this->gl_data->OSMesaPixelStore == NULL) ||
177 (this->gl_data->glGetIntegerv == NULL) ||
178 (this->gl_data->OSMesaGetProcAddress == NULL)) { 188 (this->gl_data->OSMesaGetProcAddress == NULL)) {
179 /* Hum, maybe old library ? */ 189 /* Hum, maybe old library ? */
180 if ( (this->gl_data->OSMesaCreateLDG == NULL) || 190 if ( (this->gl_data->OSMesaCreateLDG == NULL) ||
181 (this->gl_data->OSMesaDestroyLDG == NULL)) { 191 (this->gl_data->OSMesaDestroyLDG == NULL)) {
182 SDL_SetError("Could not retrieve OpenGL functions"); 192 SDL_SetError("Could not retrieve OSMesa functions");
193 SDL_UnloadObject(handle);
194 /* Restore pointers to static library */
195 SDL_AtariGL_InitPointers(this);
183 return -1; 196 return -1;
184 } else { 197 } else {
185 gl_oldmesa = 1; 198 gl_oldmesa = 1;
186 } 199 }
187 } 200 }
326 339
327 void SDL_AtariGL_SwapBuffers(_THIS) 340 void SDL_AtariGL_SwapBuffers(_THIS)
328 { 341 {
329 #ifdef HAVE_OPENGL 342 #ifdef HAVE_OPENGL
330 if (gl_active) { 343 if (gl_active) {
344 if (this->gl_config.dll_handle) {
345 if (this->gl_data->glFinish) {
346 this->gl_data->glFinish();
347 }
348 } else {
349 this->gl_data->glFinish();
350 }
331 gl_copyshadow(this, this->screen); 351 gl_copyshadow(this, this->screen);
332 gl_convert(this, this->screen); 352 gl_convert(this, this->screen);
333 } 353 }
334 #endif 354 #endif
335 } 355 }
340 this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt; 360 this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
341 this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext; 361 this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
342 this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent; 362 this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
343 this->gl_data->OSMesaPixelStore = OSMesaPixelStore; 363 this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
344 this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress; 364 this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
365
345 this->gl_data->glGetIntegerv = glGetIntegerv; 366 this->gl_data->glGetIntegerv = glGetIntegerv;
367 this->gl_data->glFinish = glFinish;
368
369 this->gl_data->OSMesaCreateLDG = NULL;
370 this->gl_data->OSMesaDestroyLDG = NULL;
346 #endif 371 #endif
347 } 372 }
348 373
349 /*--- Private functions ---*/ 374 /*--- Private functions ---*/
350 375
354 if (this->gl_config.dll_handle) { 379 if (this->gl_config.dll_handle) {
355 SDL_UnloadObject(this->gl_config.dll_handle); 380 SDL_UnloadObject(this->gl_config.dll_handle);
356 this->gl_config.dll_handle = NULL; 381 this->gl_config.dll_handle = NULL;
357 382
358 /* Restore pointers to static library */ 383 /* Restore pointers to static library */
359 this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt; 384 SDL_AtariGL_InitPointers(this);
360 this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
361 this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
362 this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
363 this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
364 this->gl_data->glGetIntegerv = glGetIntegerv;
365
366 this->gl_data->OSMesaCreateLDG = NULL;
367 this->gl_data->OSMesaDestroyLDG = NULL;
368 } 385 }
369 #endif 386 #endif
370 } 387 }
371 388
372 /*--- Creation of an OpenGL context using new/old functions ---*/ 389 /*--- Creation of an OpenGL context using new/old functions ---*/