Skip to content

Commit

Permalink
TinyGL does not have glFinish, only glFlush
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Nov 28, 2004
1 parent 2f61c48 commit 638169b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/video/ataricommon/SDL_atarigl.c
Expand Up @@ -116,6 +116,7 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)

#ifdef ENABLE_OSMESA_SHARED
void *handle;
SDL_bool cancel_load;

if (gl_active) {
SDL_SetError("OpenGL context already created");
Expand Down Expand Up @@ -158,9 +159,19 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)

this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
this->gl_data->glFlush = SDL_LoadFunction(handle, "glFlush");

if ( (this->gl_data->glGetIntegerv == NULL) ||
(this->gl_data->glFinish == NULL)) {
cancel_load = SDL_FALSE;
if (this->gl_data->glGetIntegerv == NULL) {
cancel_load = SDL_TRUE;
} else {
/* We need either glFinish (OSMesa) or glFlush (TinyGL) */
if ((this->gl_data->glFinish == NULL) &&
(this->gl_data->glFlush == NULL)) {
cancel_load = SDL_TRUE;
}
}
if (cancel_load) {
SDL_SetError("Could not retrieve OpenGL functions");
SDL_UnloadObject(handle);
/* Restore pointers to static library */
Expand Down Expand Up @@ -237,12 +248,6 @@ int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
GLenum mesa_attrib;
SDL_Surface *surface;

if (this->gl_config.dll_handle) {
if (this->gl_data->glGetIntegerv == NULL) {
return -1;
}
}

if (!gl_active) {
return -1;
}
Expand Down Expand Up @@ -344,6 +349,8 @@ void SDL_AtariGL_SwapBuffers(_THIS)
if (this->gl_config.dll_handle) {
if (this->gl_data->glFinish) {
this->gl_data->glFinish();
} else if (this->gl_data->glFlush) {
this->gl_data->glFlush();
}
} else {
this->gl_data->glFinish();
Expand All @@ -365,6 +372,7 @@ void SDL_AtariGL_InitPointers(_THIS)

this->gl_data->glGetIntegerv = glGetIntegerv;
this->gl_data->glFinish = glFinish;
this->gl_data->glFlush = glFlush;

this->gl_data->OSMesaCreateLDG = NULL;
this->gl_data->OSMesaDestroyLDG = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/video/ataricommon/SDL_atarigl_c.h
Expand Up @@ -53,6 +53,7 @@ struct SDL_PrivateGLData {
/* OpenGL functions */
void (*glGetIntegerv)( GLenum pname, GLint *value );
void (*glFinish)(void);
void (*glFlush)(void);

/* osmesa.ldg */
OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
Expand Down

0 comments on commit 638169b

Please sign in to comment.