# HG changeset patch # User Storlek # Date 1276909384 14400 # Node ID d03801319cb377074345b9b05741d8205f50815a # Parent ec708d886bb07479df56b8eed8318b7c816ca715 make opengl headers optional (for embedded systems) - thanks stuckie diff -r ec708d886bb0 -r d03801319cb3 configure.ac --- a/configure.ac Thu Feb 25 22:30:26 2010 -0500 +++ b/configure.ac Fri Jun 18 21:03:04 2010 -0400 @@ -156,6 +156,12 @@ fi fi +dnl OpenGL crud - it doesn't always exist +saved_cppflags=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" +AC_CHECK_HEADER([SDL_opengl.h], [AC_DEFINE([USE_OPENGL], 1, [Define to 1 if SDL's OpenGL works])]) +CPPFLAGS=$saved_cppflags + dnl ----------------------------------------------------------------------- saved_libs=$LIBS diff -r ec708d886bb0 -r d03801319cb3 include/sdlmain.h --- a/include/sdlmain.h Thu Feb 25 22:30:26 2010 -0500 +++ b/include/sdlmain.h Fri Jun 18 21:03:04 2010 -0400 @@ -7,14 +7,6 @@ /* just a fancy way to get SDL headers */ -# ifndef _USE_AUTOCONF -# ifdef _SDL_IN_PATH -# undef _SDL_BY_PATH -# else -# define _SDL_BY_PATH -# endif -# endif - # ifdef USE_X11 # undef DISABLE_X11 # ifndef __unix__ @@ -22,18 +14,11 @@ # endif # endif -# ifdef _SDL_BY_PATH -# include -# include -# ifndef __cplusplus -# include -# include -# endif -# else -# include -# include -# ifndef __cplusplus -# include +# include +# include +# ifndef __cplusplus +# include +# ifdef USE_OPENGL # include # endif # endif diff -r ec708d886bb0 -r d03801319cb3 schism/video.c --- a/schism/video.c Thu Feb 25 22:30:26 2010 -0500 +++ b/schism/video.c Fri Jun 18 21:03:04 2010 -0400 @@ -78,6 +78,19 @@ #define NVIDIA_PixelDataRange 1 +#if !defined(USE_OPENGL) +typedef unsigned int GLuint; +typedef int GLint; +typedef int GLenum; +typedef int GLsizei; +typedef void GLvoid; +typedef float GLfloat; +typedef int GLboolean; +typedef int GLbitfield; +typedef float GLclampf; +typedef unsigned char GLubyte; +#endif + #ifdef NVIDIA_PixelDataRange #ifndef WGL_NV_allocate_memory @@ -569,7 +582,9 @@ void video_startup(void) { UNUSED static int did_this_2 = 0; +#if USE_OPENGL const char *gl_ext; +#endif char *q; SDL_Rect **modes; int i, j, x, y; @@ -633,6 +648,7 @@ SKIP1: #endif if (video.desktop.want_type == VIDEO_GL) { +#if defined(USE_OPENGL) video.surface = SDL_SetVideoMode(640,400,0,SDL_OPENGL|SDL_RESIZABLE); if (!video.surface) { /* fallback */ @@ -658,6 +674,7 @@ video.gl.pixel_data_range=(strstr(gl_ext,"GL_NV_pixel_data_range") != NULL) && glPixelDataRangeNV && db_glAllocateMemoryNV && db_glFreeMemoryNV; #endif +#endif // USE_OPENGL } x = y = -1; @@ -883,8 +900,10 @@ void video_resize(unsigned int width, unsigned int height) { +#if USE_OPENGL GLfloat tex_width, tex_height; int texsize; +#endif if (!height) height = NATIVE_SCREEN_HEIGHT; if (!width) width = NATIVE_SCREEN_WIDTH; @@ -1021,6 +1040,7 @@ }; video.desktop.type = VIDEO_YUV; break; +#if defined(USE_OPENGL) case VIDEO_GL: _set_gl_attributes(); _setup_surface(width, height, SDL_OPENGL); @@ -1102,6 +1122,7 @@ my_glEndList(); video.desktop.type = VIDEO_GL; break; +#endif // USE_OPENGL }; status.flags |= (NEED_UPDATE); @@ -1699,6 +1720,7 @@ SDL_UnlockYUVOverlay(video.overlay); SDL_DisplayYUVOverlay(video.overlay, &video.clip); break; +#if defined(USE_OPENGL) case VIDEO_GL: my_glBindTexture(GL_TEXTURE_2D, video.gl.texture); my_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, @@ -1709,6 +1731,7 @@ my_glCallList(video.gl.displaylist); SDL_GL_SwapBuffers(); break; +#endif }; }