Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
glSDL support
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed May 1, 2006
1 parent 151966f commit 0e4dcc2
Show file tree
Hide file tree
Showing 43 changed files with 2,757 additions and 112 deletions.
1 change: 1 addition & 0 deletions Makefile.dc
Expand Up @@ -55,6 +55,7 @@ SRCS = \
src/video/dummy/SDL_nullevents.c \ src/video/dummy/SDL_nullevents.c \
src/video/dummy/SDL_nullmouse.c \ src/video/dummy/SDL_nullmouse.c \
src/video/dummy/SDL_nullvideo.c \ src/video/dummy/SDL_nullvideo.c \
src/video/glsdl/SDL_glsdl.c \
src/video/SDL_blit.c \ src/video/SDL_blit.c \
src/video/SDL_blit_0.c \ src/video/SDL_blit_0.c \
src/video/SDL_blit_1.c \ src/video/SDL_blit_1.c \
Expand Down
20 changes: 20 additions & 0 deletions configure.in
Expand Up @@ -1459,6 +1459,20 @@ CheckMacGL()
fi fi
} }


dnl Find glSDL
CheckglSDL()
{
AC_ARG_ENABLE(video-glsdl,
[ --enable-video-glsdl use glSDL video driver [default=yes]],
, enable_video_glsdl=yes)
AC_MSG_CHECKING(for glSDL support)
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes -a x$enable_video_glsdl = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_GLSDL)
SOURCES="$SOURCES $srcdir/src/video/glsdl/*.c"
fi
}

dnl Check for Mesa offscreen rendering dnl Check for Mesa offscreen rendering
CheckAtariOSMesa() CheckAtariOSMesa()
{ {
Expand Down Expand Up @@ -2080,6 +2094,7 @@ case "$host" in
CheckQtopia CheckQtopia
CheckPicoGUI CheckPicoGUI
CheckOpenGLX11 CheckOpenGLX11
CheckglSDL
CheckInputEvents CheckInputEvents
CheckTslib CheckTslib
CheckUSBHID CheckUSBHID
Expand Down Expand Up @@ -2178,6 +2193,7 @@ case "$host" in
CheckPHOTON CheckPHOTON
CheckX11 CheckX11
CheckOpenGLX11 CheckOpenGLX11
CheckglSDL
CheckPTHREAD CheckPTHREAD
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
Expand Down Expand Up @@ -2215,6 +2231,7 @@ case "$host" in
CheckDummyAudio CheckDummyAudio
CheckWIN32 CheckWIN32
CheckWIN32GL CheckWIN32GL
CheckglSDL
CheckDIRECTX CheckDIRECTX
CheckNASM CheckNASM
# Set up files for the audio library # Set up files for the audio library
Expand Down Expand Up @@ -2279,6 +2296,7 @@ case "$host" in
CheckNASM CheckNASM
CheckBWINDOW CheckBWINDOW
CheckBeGL CheckBeGL
CheckglSDL
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO) AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
Expand Down Expand Up @@ -2356,6 +2374,7 @@ case "$host" in
CheckX11 CheckX11
CheckMacGL CheckMacGL
CheckOpenGLX11 CheckOpenGLX11
CheckglSDL
CheckPTHREAD CheckPTHREAD
CheckAltivec CheckAltivec


Expand Down Expand Up @@ -2417,6 +2436,7 @@ case "$host" in
CheckAtariAudio CheckAtariAudio
CheckAtariLdg CheckAtariLdg
CheckAtariOSMesa CheckAtariOSMesa
CheckglSDL
CheckPTH CheckPTH
# Set up files for the audio library # Set up files for the audio library
if test x$enable_threads = xyes -a x$enable_pth = xyes; then if test x$enable_threads = xyes -a x$enable_pth = xyes; then
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -262,6 +262,7 @@
#undef SDL_VIDEO_DRIVER_GAPI #undef SDL_VIDEO_DRIVER_GAPI
#undef SDL_VIDEO_DRIVER_GEM #undef SDL_VIDEO_DRIVER_GEM
#undef SDL_VIDEO_DRIVER_GGI #undef SDL_VIDEO_DRIVER_GGI
#undef SDL_VIDEO_DRIVER_GLSDL
#undef SDL_VIDEO_DRIVER_IPOD #undef SDL_VIDEO_DRIVER_IPOD
#undef SDL_VIDEO_DRIVER_NANOX #undef SDL_VIDEO_DRIVER_NANOX
#undef SDL_VIDEO_DRIVER_OS2FS #undef SDL_VIDEO_DRIVER_OS2FS
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_amiga.h
Expand Up @@ -73,6 +73,7 @@
/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1 #define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_GLSDL 1


/* Enable OpenGL support */ /* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1 #define SDL_VIDEO_OPENGL 1
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_dreamcast.h
Expand Up @@ -102,5 +102,6 @@ typedef unsigned long uintptr_t;
/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DC 1 #define SDL_VIDEO_DRIVER_DC 1
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_GLSDL 1


#endif /* _SDL_config_dreamcast_h */ #endif /* _SDL_config_dreamcast_h */
1 change: 1 addition & 0 deletions include/SDL_config_macos.h
Expand Up @@ -90,6 +90,7 @@ typedef unsigned long uintptr_t;
/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1 #define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
#define SDL_VIDEO_DRIVER_GLSDL 1
#define SDL_VIDEO_DRIVER_TOOLBOX 1 #define SDL_VIDEO_DRIVER_TOOLBOX 1


/* Enable OpenGL support */ /* Enable OpenGL support */
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_macosx.h
Expand Up @@ -116,6 +116,7 @@


/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_GLSDL 1
#define SDL_VIDEO_DRIVER_QUARTZ 1 #define SDL_VIDEO_DRIVER_QUARTZ 1


/* Enable OpenGL support */ /* Enable OpenGL support */
Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config_win32.h
Expand Up @@ -155,6 +155,9 @@ typedef unsigned int uintptr_t;
#define SDL_VIDEO_DRIVER_DDRAW 1 #define SDL_VIDEO_DRIVER_DDRAW 1
#endif #endif
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#ifndef _WIN32_WCE
#define SDL_VIDEO_DRIVER_GLSDL 1
#endif
#define SDL_VIDEO_DRIVER_WINDIB 1 #define SDL_VIDEO_DRIVER_WINDIB 1


/* Enable OpenGL support */ /* Enable OpenGL support */
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_video.h
Expand Up @@ -124,7 +124,7 @@ typedef struct SDL_Surface {
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ #define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ #define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ #define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
#define SDL_OPENGLBLIT_OBSOLETE 0x0000000A /* Obsolete, do not use! */ #define SDL_INTERNALOPENGL 0x00000008 /* SDL uses OpenGL internally for this window */
#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ #define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ #define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
/* Used internally (read-only) */ /* Used internally (read-only) */
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_blit.c
Expand Up @@ -281,7 +281,7 @@ int SDL_CalculateBlit(SDL_Surface *surface)
video->CheckHWBlit(this, surface, surface->map->dst); video->CheckHWBlit(this, surface, surface->map->dst);
} }
} }

/* Get the blit function index, based on surface mode */ /* Get the blit function index, based on surface mode */
/* { 0 = nothing, 1 = colorkey, 2 = alpha, 3 = colorkey+alpha } */ /* { 0 = nothing, 1 = colorkey, 2 = alpha, 3 = colorkey+alpha } */
blit_index = 0; blit_index = 0;
Expand Down
18 changes: 9 additions & 9 deletions src/video/SDL_glfuncs.h
Expand Up @@ -30,7 +30,7 @@ SDL_PROC_UNUSED(void,glColor3i,(GLint,GLint,GLint))
SDL_PROC_UNUSED(void,glColor3iv,(const GLint*)) SDL_PROC_UNUSED(void,glColor3iv,(const GLint*))
SDL_PROC_UNUSED(void,glColor3s,(GLshort,GLshort,GLshort)) SDL_PROC_UNUSED(void,glColor3s,(GLshort,GLshort,GLshort))
SDL_PROC_UNUSED(void,glColor3sv,(const GLshort*)) SDL_PROC_UNUSED(void,glColor3sv,(const GLshort*))
SDL_PROC_UNUSED(void,glColor3ub,(GLubyte,GLubyte,GLubyte)) SDL_PROC(void,glColor3ub,(GLubyte,GLubyte,GLubyte))
SDL_PROC_UNUSED(void,glColor3ubv,(const GLubyte*)) SDL_PROC_UNUSED(void,glColor3ubv,(const GLubyte*))
SDL_PROC_UNUSED(void,glColor3ui,(GLuint,GLuint,GLuint)) SDL_PROC_UNUSED(void,glColor3ui,(GLuint,GLuint,GLuint))
SDL_PROC_UNUSED(void,glColor3uiv,(const GLuint*)) SDL_PROC_UNUSED(void,glColor3uiv,(const GLuint*))
Expand All @@ -46,7 +46,7 @@ SDL_PROC_UNUSED(void,glColor4i,(GLint,GLint,GLint,GLint))
SDL_PROC_UNUSED(void,glColor4iv,(const GLint*)) SDL_PROC_UNUSED(void,glColor4iv,(const GLint*))
SDL_PROC_UNUSED(void,glColor4s,(GLshort,GLshort,GLshort,GLshort)) SDL_PROC_UNUSED(void,glColor4s,(GLshort,GLshort,GLshort,GLshort))
SDL_PROC_UNUSED(void,glColor4sv,(const GLshort*)) SDL_PROC_UNUSED(void,glColor4sv,(const GLshort*))
SDL_PROC_UNUSED(void,glColor4ub,(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) SDL_PROC(void,glColor4ub,(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
SDL_PROC_UNUSED(void,glColor4ubv,(const GLubyte *v)) SDL_PROC_UNUSED(void,glColor4ubv,(const GLubyte *v))
SDL_PROC_UNUSED(void,glColor4ui,(GLuint red, GLuint green, GLuint blue, GLuint alpha)) SDL_PROC_UNUSED(void,glColor4ui,(GLuint red, GLuint green, GLuint blue, GLuint alpha))
SDL_PROC_UNUSED(void,glColor4uiv,(const GLuint *v)) SDL_PROC_UNUSED(void,glColor4uiv,(const GLuint *v))
Expand All @@ -62,14 +62,14 @@ SDL_PROC_UNUSED(void,glCopyTexSubImage1D,(GLenum target, GLint level, GLint xoff
SDL_PROC_UNUSED(void,glCopyTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) SDL_PROC_UNUSED(void,glCopyTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height))
SDL_PROC_UNUSED(void,glCullFace,(GLenum mode)) SDL_PROC_UNUSED(void,glCullFace,(GLenum mode))
SDL_PROC_UNUSED(void,glDeleteLists,(GLuint list, GLsizei range)) SDL_PROC_UNUSED(void,glDeleteLists,(GLuint list, GLsizei range))
SDL_PROC_UNUSED(void,glDeleteTextures,(GLsizei n, const GLuint *textures)) SDL_PROC(void,glDeleteTextures,(GLsizei n, const GLuint *textures))
SDL_PROC_UNUSED(void,glDepthFunc,(GLenum func)) SDL_PROC_UNUSED(void,glDepthFunc,(GLenum func))
SDL_PROC_UNUSED(void,glDepthMask,(GLboolean flag)) SDL_PROC_UNUSED(void,glDepthMask,(GLboolean flag))
SDL_PROC_UNUSED(void,glDepthRange,(GLclampd zNear, GLclampd zFar)) SDL_PROC_UNUSED(void,glDepthRange,(GLclampd zNear, GLclampd zFar))
SDL_PROC(void,glDisable,(GLenum cap)) SDL_PROC(void,glDisable,(GLenum cap))
SDL_PROC_UNUSED(void,glDisableClientState,(GLenum array)) SDL_PROC_UNUSED(void,glDisableClientState,(GLenum array))
SDL_PROC_UNUSED(void,glDrawArrays,(GLenum mode, GLint first, GLsizei count)) SDL_PROC_UNUSED(void,glDrawArrays,(GLenum mode, GLint first, GLsizei count))
SDL_PROC_UNUSED(void,glDrawBuffer,(GLenum mode)) SDL_PROC(void,glDrawBuffer,(GLenum mode))
SDL_PROC_UNUSED(void,glDrawElements,(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) SDL_PROC_UNUSED(void,glDrawElements,(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices))
SDL_PROC_UNUSED(void,glDrawPixels,(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) SDL_PROC_UNUSED(void,glDrawPixels,(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
SDL_PROC_UNUSED(void,glEdgeFlag,(GLboolean flag)) SDL_PROC_UNUSED(void,glEdgeFlag,(GLboolean flag))
Expand All @@ -92,7 +92,7 @@ SDL_PROC_UNUSED(void,glEvalMesh2,(GLenum mode, GLint i1, GLint i2, GLint j1, GLi
SDL_PROC_UNUSED(void,glEvalPoint1,(GLint i)) SDL_PROC_UNUSED(void,glEvalPoint1,(GLint i))
SDL_PROC_UNUSED(void,glEvalPoint2,(GLint i, GLint j)) SDL_PROC_UNUSED(void,glEvalPoint2,(GLint i, GLint j))
SDL_PROC_UNUSED(void,glFeedbackBuffer,(GLsizei size, GLenum type, GLfloat *buffer)) SDL_PROC_UNUSED(void,glFeedbackBuffer,(GLsizei size, GLenum type, GLfloat *buffer))
SDL_PROC_UNUSED(void,glFinish,(void)) SDL_PROC(void,glFinish,(void))
SDL_PROC(void,glFlush,(void)) SDL_PROC(void,glFlush,(void))
SDL_PROC_UNUSED(void,glFogf,(GLenum pname, GLfloat param)) SDL_PROC_UNUSED(void,glFogf,(GLenum pname, GLfloat param))
SDL_PROC_UNUSED(void,glFogfv,(GLenum pname, const GLfloat *params)) SDL_PROC_UNUSED(void,glFogfv,(GLenum pname, const GLfloat *params))
Expand All @@ -105,9 +105,9 @@ SDL_PROC(void,glGenTextures,(GLsizei n, GLuint *textures))
SDL_PROC_UNUSED(void,glGetBooleanv,(GLenum pname, GLboolean *params)) SDL_PROC_UNUSED(void,glGetBooleanv,(GLenum pname, GLboolean *params))
SDL_PROC_UNUSED(void,glGetClipPlane,(GLenum plane, GLdouble *equation)) SDL_PROC_UNUSED(void,glGetClipPlane,(GLenum plane, GLdouble *equation))
SDL_PROC_UNUSED(void,glGetDoublev,(GLenum pname, GLdouble *params)) SDL_PROC_UNUSED(void,glGetDoublev,(GLenum pname, GLdouble *params))
SDL_PROC_UNUSED(GLenum,glGetError,(void)) SDL_PROC(GLenum,glGetError,(void))
SDL_PROC_UNUSED(void,glGetFloatv,(GLenum pname, GLfloat *params)) SDL_PROC_UNUSED(void,glGetFloatv,(GLenum pname, GLfloat *params))
SDL_PROC_UNUSED(void,glGetIntegerv,(GLenum pname, GLint *params)) SDL_PROC(void,glGetIntegerv,(GLenum pname, GLint *params))
SDL_PROC_UNUSED(void,glGetLightfv,(GLenum light, GLenum pname, GLfloat *params)) SDL_PROC_UNUSED(void,glGetLightfv,(GLenum light, GLenum pname, GLfloat *params))
SDL_PROC_UNUSED(void,glGetLightiv,(GLenum light, GLenum pname, GLint *params)) SDL_PROC_UNUSED(void,glGetLightiv,(GLenum light, GLenum pname, GLint *params))
SDL_PROC_UNUSED(void,glGetMapdv,(GLenum target, GLenum query, GLdouble *v)) SDL_PROC_UNUSED(void,glGetMapdv,(GLenum target, GLenum query, GLdouble *v))
Expand Down Expand Up @@ -240,7 +240,7 @@ SDL_PROC_UNUSED(void,glRasterPos4iv,(const GLint *v))
SDL_PROC_UNUSED(void,glRasterPos4s,(GLshort x, GLshort y, GLshort z, GLshort w)) SDL_PROC_UNUSED(void,glRasterPos4s,(GLshort x, GLshort y, GLshort z, GLshort w))
SDL_PROC_UNUSED(void,glRasterPos4sv,(const GLshort *v)) SDL_PROC_UNUSED(void,glRasterPos4sv,(const GLshort *v))
SDL_PROC_UNUSED(void,glReadBuffer,(GLenum mode)) SDL_PROC_UNUSED(void,glReadBuffer,(GLenum mode))
SDL_PROC_UNUSED(void,glReadPixels,(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) SDL_PROC(void,glReadPixels,(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))
SDL_PROC_UNUSED(void,glRectd,(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)) SDL_PROC_UNUSED(void,glRectd,(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2))
SDL_PROC_UNUSED(void,glRectdv,(const GLdouble *v1, const GLdouble *v2)) SDL_PROC_UNUSED(void,glRectdv,(const GLdouble *v1, const GLdouble *v2))
SDL_PROC_UNUSED(void,glRectf,(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)) SDL_PROC_UNUSED(void,glRectf,(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2))
Expand Down Expand Up @@ -311,7 +311,7 @@ SDL_PROC(void,glTexParameteri,(GLenum target, GLenum pname, GLint param))
SDL_PROC_UNUSED(void,glTexParameteriv,(GLenum target, GLenum pname, const GLint *params)) SDL_PROC_UNUSED(void,glTexParameteriv,(GLenum target, GLenum pname, const GLint *params))
SDL_PROC_UNUSED(void,glTexSubImage1D,(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) SDL_PROC_UNUSED(void,glTexSubImage1D,(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels))
SDL_PROC(void,glTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) SDL_PROC(void,glTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
SDL_PROC_UNUSED(void,glTranslated,(GLdouble x, GLdouble y, GLdouble z)) SDL_PROC(void,glTranslated,(GLdouble x, GLdouble y, GLdouble z))
SDL_PROC_UNUSED(void,glTranslatef,(GLfloat x, GLfloat y, GLfloat z)) SDL_PROC_UNUSED(void,glTranslatef,(GLfloat x, GLfloat y, GLfloat z))
SDL_PROC_UNUSED(void,glVertex2d,(GLdouble x, GLdouble y)) SDL_PROC_UNUSED(void,glVertex2d,(GLdouble x, GLdouble y))
SDL_PROC_UNUSED(void,glVertex2dv,(const GLdouble *v)) SDL_PROC_UNUSED(void,glVertex2dv,(const GLdouble *v))
Expand Down
5 changes: 4 additions & 1 deletion src/video/SDL_sysvideo.h
Expand Up @@ -119,7 +119,7 @@ struct SDL_VideoDevice {


/* The pixel format used when SDL_CreateRGBSurface creates SDL_HWSURFACEs with alpha */ /* The pixel format used when SDL_CreateRGBSurface creates SDL_HWSURFACEs with alpha */
SDL_PixelFormat* displayformatalphapixel; SDL_PixelFormat* displayformatalphapixel;

/* Allocates a surface in video memory */ /* Allocates a surface in video memory */
int (*AllocHWSurface)(_THIS, SDL_Surface *surface); int (*AllocHWSurface)(_THIS, SDL_Surface *surface);


Expand Down Expand Up @@ -407,6 +407,9 @@ extern VideoBootStrap AALIB_bootstrap;
#if SDL_VIDEO_DRIVER_DUMMY #if SDL_VIDEO_DRIVER_DUMMY
extern VideoBootStrap DUMMY_bootstrap; extern VideoBootStrap DUMMY_bootstrap;
#endif #endif
#if SDL_VIDEO_DRIVER_GLSDL
extern VideoBootStrap glSDL_bootstrap;
#endif


/* This is the current video device */ /* This is the current video device */
extern SDL_VideoDevice *current_video; extern SDL_VideoDevice *current_video;
Expand Down
25 changes: 14 additions & 11 deletions src/video/SDL_video.c
Expand Up @@ -122,6 +122,9 @@ static VideoBootStrap *bootstrap[] = {
#endif #endif
#if SDL_VIDEO_DRIVER_DUMMY #if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap, &DUMMY_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_GLSDL
&glSDL_bootstrap,
#endif #endif
NULL NULL
}; };
Expand Down Expand Up @@ -575,12 +578,6 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
int is_opengl; int is_opengl;
SDL_GrabMode saved_grab; SDL_GrabMode saved_grab;


/* Handle obsolete flags */
if ( (flags & SDL_OPENGLBLIT_OBSOLETE) == SDL_OPENGLBLIT_OBSOLETE ) {
SDL_SetError("SDL_OPENGLBLIT is no longer supported");
return(NULL);
}

/* Start up the video driver, if necessary.. /* Start up the video driver, if necessary..
WARNING: This is the only function protected this way! WARNING: This is the only function protected this way!
*/ */
Expand Down Expand Up @@ -613,8 +610,12 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
} }


/* Check the requested flags */ /* Check the requested flags */
/* There's no palette in > 8 bits-per-pixel mode */ if ( flags & SDL_INTERNALOPENGL ) {
SDL_SetError("SDL_INTERNALOPENGL is for internal use only");
return(NULL);
}
if ( video_bpp > 8 ) { if ( video_bpp > 8 ) {
/* There's no palette in > 8 bits-per-pixel mode */
flags &= ~SDL_HWPALETTE; flags &= ~SDL_HWPALETTE;
} }
#if 0 #if 0
Expand All @@ -632,6 +633,8 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
if ( is_opengl ) { if ( is_opengl ) {
/* These flags are for 2D video modes only */ /* These flags are for 2D video modes only */
flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF); flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF);
/* This flag tells the backends to treat the surface accordingly */
flags |= SDL_INTERNALOPENGL;
} }


/* Reset the keyboard here so event callbacks can run */ /* Reset the keyboard here so event callbacks can run */
Expand Down Expand Up @@ -674,7 +677,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
#endif #endif


/* Sam - If we asked for OpenGL mode, and didn't get it, fail */ /* Sam - If we asked for OpenGL mode, and didn't get it, fail */
if ( is_opengl && !(mode->flags & SDL_OPENGL) ) { if ( is_opengl && !(mode->flags & SDL_INTERNALOPENGL) ) {
mode = NULL; mode = NULL;
SDL_SetError("OpenGL not available"); SDL_SetError("OpenGL not available");
} }
Expand Down Expand Up @@ -752,7 +755,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)


#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
/* Load GL symbols (before MakeCurrent, where we need glGetString). */ /* Load GL symbols (before MakeCurrent, where we need glGetString). */
if ( flags & SDL_OPENGL ) { if ( flags & SDL_INTERNALOPENGL ) {


#if defined(__QNXNTO__) && (_NTO_VERSION < 630) #if defined(__QNXNTO__) && (_NTO_VERSION < 630)
#define __SDL_NOGETPROCADDR__ #define __SDL_NOGETPROCADDR__
Expand All @@ -779,7 +782,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL */


/* If we're running OpenGL, make the context current */ /* If we're running OpenGL, make the context current */
if ( (video->screen->flags & SDL_OPENGL) && if ( (video->screen->flags & SDL_INTERNALOPENGL) &&
video->GL_MakeCurrent ) { video->GL_MakeCurrent ) {
if ( video->GL_MakeCurrent(this) < 0 ) { if ( video->GL_MakeCurrent(this) < 0 ) {
return(NULL); return(NULL);
Expand Down Expand Up @@ -1431,7 +1434,7 @@ void SDL_GL_SwapBuffers(void)
SDL_VideoDevice *video = current_video; SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video; SDL_VideoDevice *this = current_video;


if ( video->screen->flags & SDL_OPENGL ) { if ( video->screen->flags & SDL_INTERNALOPENGL ) {
video->GL_SwapBuffers(this); video->GL_SwapBuffers(this);
} else { } else {
SDL_SetError("OpenGL video mode has not been set"); SDL_SetError("OpenGL video mode has not been set");
Expand Down
2 changes: 1 addition & 1 deletion src/video/bwindow/SDL_BWin.h
Expand Up @@ -219,7 +219,7 @@ class SDL_BWin : public BDirectWindow


retval = 0; retval = 0;
Lock(); Lock();
if ( flags & SDL_OPENGL ) { if ( flags & SDL_INTERNALOPENGL ) {
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
if ( SDL_GLView == NULL ) { if ( SDL_GLView == NULL ) {
SDL_GLView = new BGLView(Bounds(), "SDL GLView", SDL_GLView = new BGLView(Bounds(), "SDL GLView",
Expand Down
6 changes: 3 additions & 3 deletions src/video/bwindow/SDL_sysvideo.cc
Expand Up @@ -525,7 +525,7 @@ SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface *current,
current->flags |= SDL_NOFRAME; current->flags |= SDL_NOFRAME;
SDL_Win->SetLook(B_NO_BORDER_WINDOW_LOOK); SDL_Win->SetLook(B_NO_BORDER_WINDOW_LOOK);
} else { } else {
if ( (flags & SDL_RESIZABLE) && !(flags & SDL_OPENGL) ) { if ( (flags & SDL_RESIZABLE) && !(flags & SDL_INTERNALOPENGL) ) {
current->flags |= SDL_RESIZABLE; current->flags |= SDL_RESIZABLE;
/* We don't want opaque resizing (TM). :-) */ /* We don't want opaque resizing (TM). :-) */
SDL_Win->SetFlags(B_OUTLINE_RESIZE); SDL_Win->SetFlags(B_OUTLINE_RESIZE);
Expand All @@ -534,8 +534,8 @@ SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface *current,
} }
} }


if ( flags & SDL_OPENGL ) { if ( flags & SDL_INTERNALOPENGL ) {
current->flags |= SDL_OPENGL; current->flags |= SDL_INTERNALOPENGL;
current->pitch = 0; current->pitch = 0;
current->pixels = NULL; current->pixels = NULL;
_this->UpdateRects = NULL; _this->UpdateRects = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/video/cybergfx/SDL_cgximage.c
Expand Up @@ -135,7 +135,7 @@ int CGX_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)


CGX_DestroyImage(this, screen); CGX_DestroyImage(this, screen);


if ( flags & SDL_OPENGL ) { /* No image when using GL */ if ( flags & SDL_INTERNALOPENGL ) { /* No image when using GL */
retval = 0; retval = 0;
} else { } else {
retval = CGX_SetupImage(this, screen); retval = CGX_SetupImage(this, screen);
Expand Down

0 comments on commit 0e4dcc2

Please sign in to comment.