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

Commit

Permalink
Implemented Windows OpenGL support
Browse files Browse the repository at this point in the history
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 ebcb7b7
Show file tree
Hide file tree
Showing 14 changed files with 1,024 additions and 248 deletions.
2 changes: 1 addition & 1 deletion src/SDL_compat.c
Expand Up @@ -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;
}
Expand Down
15 changes: 8 additions & 7 deletions src/video/SDL_sysvideo.h
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
11 changes: 4 additions & 7 deletions src/video/SDL_video.c
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/dummy/SDL_nullvideo.c
Expand Up @@ -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;
Expand Down

0 comments on commit ebcb7b7

Please sign in to comment.