Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Implemented Windows OpenGL support

Fixed slowdown enumerating display modes, which was hosing OpenGL as well...
Removed SDL_ from the render driver prefixes
  • Loading branch information
slouken committed Jul 17, 2006
1 parent 4f62229 commit ebcb7b71ac86cce52ab30f72ce79d6d00ea35ccb
@@ -337,7 +337,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface = NULL;
}
if (SDL_VideoContext) {
SDL_GL_MakeCurrent(0, SDL_VideoContext);
SDL_GL_MakeCurrent(0, NULL);
SDL_GL_DeleteContext(SDL_VideoContext);
SDL_VideoContext = NULL;
}
@@ -172,6 +172,11 @@ struct SDL_VideoDevice
*/
int (*VideoInit) (_THIS);

/* Reverse the effects VideoInit() -- called if VideoInit() fails
or if the application is shutting down the video subsystem.
*/
void (*VideoQuit) (_THIS);

/* * * */
/* Display functions
*/
@@ -221,17 +226,13 @@ struct SDL_VideoDevice
SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
struct SDL_SysWMinfo * info);

/* Reverse the effects VideoInit() -- called if VideoInit() fails
or if the application is shutting down the video subsystem.
*/
void (*VideoQuit) (_THIS);

/* * * */
/* OpenGL support
*/
int (*GL_LoadLibrary) (_THIS, const char *path);
void *(*GL_GetProcAddress) (_THIS, const char *proc);
int (*GL_GetAttribute) (_THIS, SDL_GLattr attrib, int *value);
int (*GL_GetWindowAttribute) (_THIS, SDL_Window * window,
SDL_GLattr attrib, int *value);
SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
int (*GL_SetSwapInterval) (_THIS, int interval);
@@ -279,7 +280,7 @@ struct SDL_VideoDevice
/* * * */
/* Data private to this driver */
void *driverdata;
struct SDL_PrivateGLData *gl_data;
struct SDL_GLDriverData *gl_data;

/* * * */
/* The function used to dispose of this structure */
@@ -2117,11 +2117,11 @@ SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
return -1;
}

if (_this->GL_GetAttribute) {
retval = _this->GL_GetAttribute(_this, attr, value);
if (_this->GL_GetWindowAttribute) {
retval = _this->GL_GetWindowAttribute(_this, window, attr, value);
} else {
*value = 0;
SDL_SetError("GL_GetAttribute not supported");
SDL_SetError("GL_GetWindowAttribute not supported");
retval = -1;
}
return retval;
@@ -2147,10 +2147,7 @@ SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
{
SDL_Window *window = SDL_GetWindowFromID(windowID);

if (!window || !context) {
return -1;
}
if (!(window->flags & SDL_WINDOW_OPENGL)) {
if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
SDL_SetError("The specified window isn't an OpenGL window");
return -1;
}
@@ -89,8 +89,8 @@ DUMMY_CreateDevice(int devindex)

/* Set the function pointers */
device->VideoInit = DUMMY_VideoInit;
device->SetDisplayMode = DUMMY_SetDisplayMode;
device->VideoQuit = DUMMY_VideoQuit;
device->SetDisplayMode = DUMMY_SetDisplayMode;
device->PumpEvents = DUMMY_PumpEvents;

device->free = DUMMY_DeleteDevice;

0 comments on commit ebcb7b7

Please sign in to comment.