src/video/ataricommon/SDL_atarigl.c
changeset 993 2662da16d668
parent 992 0324ce32b2d9
child 995 22fc5f45bbb7
     1.1 --- a/src/video/ataricommon/SDL_atarigl.c	Fri Nov 26 22:11:30 2004 +0000
     1.2 +++ b/src/video/ataricommon/SDL_atarigl.c	Sat Nov 27 21:28:49 2004 +0000
     1.3 @@ -156,13 +156,24 @@
     1.4  		return -1;
     1.5  	}
     1.6  
     1.7 +	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
     1.8 +	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
     1.9 +
    1.10 +	if ( (this->gl_data->glGetIntegerv == NULL) || 
    1.11 +	     (this->gl_data->glFinish == NULL)) {
    1.12 +		SDL_SetError("Could not retrieve OpenGL functions");
    1.13 +		SDL_UnloadObject(handle);
    1.14 +		/* Restore pointers to static library */
    1.15 +		SDL_AtariGL_InitPointers(this);
    1.16 +		return -1;
    1.17 +	}
    1.18 +
    1.19  	/* Load functions pointers (osmesa.ldg) */
    1.20  	this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt");
    1.21  	this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext");
    1.22  	this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent");
    1.23  	this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore");
    1.24  	this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress");
    1.25 -	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
    1.26  
    1.27  	/* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
    1.28  	this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG");
    1.29 @@ -174,12 +185,14 @@
    1.30  	     (this->gl_data->OSMesaDestroyContext == NULL) ||
    1.31  	     (this->gl_data->OSMesaMakeCurrent == NULL) ||
    1.32  	     (this->gl_data->OSMesaPixelStore == NULL) ||
    1.33 -	     (this->gl_data->glGetIntegerv == NULL) ||
    1.34  	     (this->gl_data->OSMesaGetProcAddress == NULL)) {
    1.35  		/* Hum, maybe old library ? */
    1.36  		if ( (this->gl_data->OSMesaCreateLDG == NULL) || 
    1.37  		     (this->gl_data->OSMesaDestroyLDG == NULL)) {
    1.38 -			SDL_SetError("Could not retrieve OpenGL functions");
    1.39 +			SDL_SetError("Could not retrieve OSMesa functions");
    1.40 +			SDL_UnloadObject(handle);
    1.41 +			/* Restore pointers to static library */
    1.42 +			SDL_AtariGL_InitPointers(this);
    1.43  			return -1;
    1.44  		} else {
    1.45  			gl_oldmesa = 1;
    1.46 @@ -328,6 +341,13 @@
    1.47  {
    1.48  #ifdef HAVE_OPENGL
    1.49  	if (gl_active) {
    1.50 +		if (this->gl_config.dll_handle) {
    1.51 +			if (this->gl_data->glFinish) {
    1.52 +				this->gl_data->glFinish();
    1.53 +			}
    1.54 +		} else {
    1.55 +			this->gl_data->glFinish();
    1.56 +		}
    1.57  		gl_copyshadow(this, this->screen);
    1.58  		gl_convert(this, this->screen);
    1.59  	}
    1.60 @@ -342,7 +362,12 @@
    1.61  	this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
    1.62  	this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
    1.63  	this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
    1.64 +
    1.65  	this->gl_data->glGetIntegerv = glGetIntegerv;
    1.66 +	this->gl_data->glFinish = glFinish;
    1.67 +
    1.68 +	this->gl_data->OSMesaCreateLDG = NULL;
    1.69 +	this->gl_data->OSMesaDestroyLDG = NULL;
    1.70  #endif
    1.71  }
    1.72  
    1.73 @@ -356,15 +381,7 @@
    1.74  		this->gl_config.dll_handle = NULL;
    1.75  
    1.76  		/* Restore pointers to static library */
    1.77 -		this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
    1.78 -		this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
    1.79 -		this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
    1.80 -		this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
    1.81 -		this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
    1.82 -		this->gl_data->glGetIntegerv = glGetIntegerv;
    1.83 -
    1.84 -		this->gl_data->OSMesaCreateLDG = NULL;
    1.85 -		this->gl_data->OSMesaDestroyLDG = NULL;
    1.86 +		SDL_AtariGL_InitPointers(this);
    1.87  	}
    1.88  #endif
    1.89  }