src/video/ataricommon/SDL_atarigl.c
changeset 995 22fc5f45bbb7
parent 993 2662da16d668
child 1000 fbeac9312843
     1.1 --- a/src/video/ataricommon/SDL_atarigl.c	Sat Nov 27 23:11:20 2004 +0000
     1.2 +++ b/src/video/ataricommon/SDL_atarigl.c	Sun Nov 28 21:52:29 2004 +0000
     1.3 @@ -116,6 +116,7 @@
     1.4  
     1.5  #ifdef ENABLE_OSMESA_SHARED
     1.6  	void *handle;
     1.7 +	SDL_bool cancel_load;
     1.8  
     1.9  	if (gl_active) {
    1.10  		SDL_SetError("OpenGL context already created");
    1.11 @@ -158,9 +159,19 @@
    1.12  
    1.13  	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
    1.14  	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
    1.15 +	this->gl_data->glFlush = SDL_LoadFunction(handle, "glFlush");
    1.16  
    1.17 -	if ( (this->gl_data->glGetIntegerv == NULL) || 
    1.18 -	     (this->gl_data->glFinish == NULL)) {
    1.19 +	cancel_load = SDL_FALSE;
    1.20 +	if (this->gl_data->glGetIntegerv == NULL) {
    1.21 +		cancel_load = SDL_TRUE;
    1.22 +	} else {
    1.23 +		/* We need either glFinish (OSMesa) or glFlush (TinyGL) */
    1.24 +		if ((this->gl_data->glFinish == NULL) &&
    1.25 +			(this->gl_data->glFlush == NULL)) {
    1.26 +				cancel_load = SDL_TRUE;
    1.27 +		}
    1.28 +	}
    1.29 +	if (cancel_load) {
    1.30  		SDL_SetError("Could not retrieve OpenGL functions");
    1.31  		SDL_UnloadObject(handle);
    1.32  		/* Restore pointers to static library */
    1.33 @@ -237,12 +248,6 @@
    1.34  	GLenum mesa_attrib;
    1.35  	SDL_Surface *surface;
    1.36  
    1.37 -	if (this->gl_config.dll_handle) {
    1.38 -		if (this->gl_data->glGetIntegerv == NULL) {
    1.39 -			return -1;
    1.40 -		}
    1.41 -	}
    1.42 -
    1.43  	if (!gl_active) {
    1.44  		return -1;
    1.45  	}
    1.46 @@ -344,6 +349,8 @@
    1.47  		if (this->gl_config.dll_handle) {
    1.48  			if (this->gl_data->glFinish) {
    1.49  				this->gl_data->glFinish();
    1.50 +			} else if (this->gl_data->glFlush) {
    1.51 +				this->gl_data->glFlush();
    1.52  			}
    1.53  		} else {
    1.54  			this->gl_data->glFinish();
    1.55 @@ -365,6 +372,7 @@
    1.56  
    1.57  	this->gl_data->glGetIntegerv = glGetIntegerv;
    1.58  	this->gl_data->glFinish = glFinish;
    1.59 +	this->gl_data->glFlush = glFlush;
    1.60  
    1.61  	this->gl_data->OSMesaCreateLDG = NULL;
    1.62  	this->gl_data->OSMesaDestroyLDG = NULL;