Mercurial > sdl-ios-xcode
changeset 1727:90a3e0fccb88 SDL-1.3
Started on the OpenGL API revamp.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 07 Jul 2006 10:29:16 +0000 |
parents | 18223b2ec68c |
children | b1ee090d194f |
files | include/SDL_compat.h include/SDL_video.h src/video/win32/SDL_win32events.c |
diffstat | 3 files changed, 85 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/include/SDL_compat.h Fri Jul 07 08:07:16 2006 +0000 +++ b/include/SDL_compat.h Fri Jul 07 10:29:16 2006 +0000 @@ -171,6 +171,7 @@ extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect); extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay); +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); /* Ends C function definitions when using C++ */ #ifdef __cplusplus
--- a/include/SDL_video.h Fri Jul 07 08:07:16 2006 +0000 +++ b/include/SDL_video.h Fri Jul 07 10:29:16 2006 +0000 @@ -313,8 +313,7 @@ SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, - SDL_GL_ACCELERATED_VISUAL, - SDL_GL_SWAP_CONTROL + SDL_GL_ACCELERATED_VISUAL } SDL_GLattr; @@ -1377,6 +1376,7 @@ * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) * * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format. + * * \note This function uses a static buffer, and is not thread-safe. */ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, @@ -1388,40 +1388,99 @@ /* OpenGL support functions. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Dynamically load an OpenGL library, or the default one if path is NULL +/** + * \fn int SDL_GL_LoadLibrary(const char *path) + * + * \brief Dynamically load an OpenGL library. + * + * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library * - * If you do this, you need to retrieve all of the GL functions used in - * your program from the dynamic library using SDL_GL_GetProcAddress(). + * \return 0 on success, or -1 if the library couldn't be loaded + * + * \note If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * \sa SDL_GL_GetProcAddress() */ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); -/* - * Get the address of a GL function +/** + * \fn void *SDL_GL_GetProcAddress(const char *proc) + * + * \brief Get the address of an OpenGL function. */ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); -/* - * Set an attribute of the OpenGL subsystem before window creation. +/** + * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value) + * + * \brief Set an OpenGL window attribute before window creation. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); -/* - * Get an attribute of the OpenGL subsystem from the windowing - * interface, such as glX. This is of course different from getting - * the values from SDL's internal OpenGL subsystem, which only - * stores the values you request before initialization. +/** + * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value) + * + * \brief Get the actual value for an OpenGL window attribute. + */ +extern DECLSPEC int SDLCALL SDL_GL_GetWindowAttribute(SDL_WindowID windowID, + SDL_GLattr attr, + int *value); + +/** + * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID) + * + * \brief Create an OpenGL context for use with an OpenGL window, and make it current. + * + * \sa SDL_GL_DeleteContext() + */ +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID + windowID); + +/** + * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context) + * + * \brief Set up an OpenGL context for rendering into an OpenGL window. * - * Developers should track the values they pass into SDL_GL_SetAttribute - * themselves if they want to retrieve these values. + * \note The context must have been created with a compatible window. + */ +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID, + SDL_GLContext context); + +/** + * \fn int SDL_GL_SetSwapInterval(int interval) + * + * \brief Set the swap interval for the current OpenGL context. + * + * \sa SDL_GL_GetSwapInterval() */ -extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); +extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); -/* +/** + * \fn int SDL_GL_GetSwapInterval(void) + * + * \brief Get the swap interval for the current OpenGL context. + * + * \sa SDL_GL_SetSwapInterval() + */ +extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); + +/** + * \fn void SDL_GL_SwapBuffers(void) + * * Swap the OpenGL buffers, if double-buffering is supported. */ extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); +/** + * \fn void SDL_GL_DeleteContext(SDL_GLContext context) + * + * \brief Delete an OpenGL context. + * + * \sa SDL_GL_CreateContext() + */ +extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); + /* * Calculate the intersection of two rectangles */
--- a/src/video/win32/SDL_win32events.c Fri Jul 07 08:07:16 2006 +0000 +++ b/src/video/win32/SDL_win32events.c Fri Jul 07 10:29:16 2006 +0000 @@ -814,6 +814,12 @@ } return (0); + /* We'll do our own drawing, prevent flicker */ + case WM_ERASEBKGND: + { + } + return (1); + case WM_SYSCOMMAND: { /* Don't start the screensaver or blank the monitor in fullscreen apps */