src/video/ataricommon/SDL_atarigl.c
changeset 995 22fc5f45bbb7
parent 993 2662da16d668
child 1000 fbeac9312843
equal deleted inserted replaced
994:c4e5473672b6 995:22fc5f45bbb7
   114 {
   114 {
   115 #ifdef HAVE_OPENGL
   115 #ifdef HAVE_OPENGL
   116 
   116 
   117 #ifdef ENABLE_OSMESA_SHARED
   117 #ifdef ENABLE_OSMESA_SHARED
   118 	void *handle;
   118 	void *handle;
       
   119 	SDL_bool cancel_load;
   119 
   120 
   120 	if (gl_active) {
   121 	if (gl_active) {
   121 		SDL_SetError("OpenGL context already created");
   122 		SDL_SetError("OpenGL context already created");
   122 		return -1;
   123 		return -1;
   123 	}
   124 	}
   156 		return -1;
   157 		return -1;
   157 	}
   158 	}
   158 
   159 
   159 	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
   160 	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
   160 	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
   161 	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
   161 
   162 	this->gl_data->glFlush = SDL_LoadFunction(handle, "glFlush");
   162 	if ( (this->gl_data->glGetIntegerv == NULL) || 
   163 
   163 	     (this->gl_data->glFinish == NULL)) {
   164 	cancel_load = SDL_FALSE;
       
   165 	if (this->gl_data->glGetIntegerv == NULL) {
       
   166 		cancel_load = SDL_TRUE;
       
   167 	} else {
       
   168 		/* We need either glFinish (OSMesa) or glFlush (TinyGL) */
       
   169 		if ((this->gl_data->glFinish == NULL) &&
       
   170 			(this->gl_data->glFlush == NULL)) {
       
   171 				cancel_load = SDL_TRUE;
       
   172 		}
       
   173 	}
       
   174 	if (cancel_load) {
   164 		SDL_SetError("Could not retrieve OpenGL functions");
   175 		SDL_SetError("Could not retrieve OpenGL functions");
   165 		SDL_UnloadObject(handle);
   176 		SDL_UnloadObject(handle);
   166 		/* Restore pointers to static library */
   177 		/* Restore pointers to static library */
   167 		SDL_AtariGL_InitPointers(this);
   178 		SDL_AtariGL_InitPointers(this);
   168 		return -1;
   179 		return -1;
   235 {
   246 {
   236 #ifdef HAVE_OPENGL
   247 #ifdef HAVE_OPENGL
   237 	GLenum mesa_attrib;
   248 	GLenum mesa_attrib;
   238 	SDL_Surface *surface;
   249 	SDL_Surface *surface;
   239 
   250 
   240 	if (this->gl_config.dll_handle) {
       
   241 		if (this->gl_data->glGetIntegerv == NULL) {
       
   242 			return -1;
       
   243 		}
       
   244 	}
       
   245 
       
   246 	if (!gl_active) {
   251 	if (!gl_active) {
   247 		return -1;
   252 		return -1;
   248 	}
   253 	}
   249 
   254 
   250 	switch(attrib) {
   255 	switch(attrib) {
   342 #ifdef HAVE_OPENGL
   347 #ifdef HAVE_OPENGL
   343 	if (gl_active) {
   348 	if (gl_active) {
   344 		if (this->gl_config.dll_handle) {
   349 		if (this->gl_config.dll_handle) {
   345 			if (this->gl_data->glFinish) {
   350 			if (this->gl_data->glFinish) {
   346 				this->gl_data->glFinish();
   351 				this->gl_data->glFinish();
       
   352 			} else if (this->gl_data->glFlush) {
       
   353 				this->gl_data->glFlush();
   347 			}
   354 			}
   348 		} else {
   355 		} else {
   349 			this->gl_data->glFinish();
   356 			this->gl_data->glFinish();
   350 		}
   357 		}
   351 		gl_copyshadow(this, this->screen);
   358 		gl_copyshadow(this, this->screen);
   363 	this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
   370 	this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
   364 	this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
   371 	this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
   365 
   372 
   366 	this->gl_data->glGetIntegerv = glGetIntegerv;
   373 	this->gl_data->glGetIntegerv = glGetIntegerv;
   367 	this->gl_data->glFinish = glFinish;
   374 	this->gl_data->glFinish = glFinish;
       
   375 	this->gl_data->glFlush = glFlush;
   368 
   376 
   369 	this->gl_data->OSMesaCreateLDG = NULL;
   377 	this->gl_data->OSMesaCreateLDG = NULL;
   370 	this->gl_data->OSMesaDestroyLDG = NULL;
   378 	this->gl_data->OSMesaDestroyLDG = NULL;
   371 #endif
   379 #endif
   372 }
   380 }