Started on the OpenGL API revamp. SDL-1.3
authorSam Lantinga <slouken@libsdl.org>
Fri, 07 Jul 2006 10:29:16 +0000
branchSDL-1.3
changeset 172790a3e0fccb88
parent 1726 18223b2ec68c
child 1728 b1ee090d194f
Started on the OpenGL API revamp.
include/SDL_compat.h
include/SDL_video.h
src/video/win32/SDL_win32events.c
     1.1 --- a/include/SDL_compat.h	Fri Jul 07 08:07:16 2006 +0000
     1.2 +++ b/include/SDL_compat.h	Fri Jul 07 10:29:16 2006 +0000
     1.3 @@ -171,6 +171,7 @@
     1.4  extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
     1.5                                                    SDL_Rect * dstrect);
     1.6  extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
     1.7 +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
     1.8  
     1.9  /* Ends C function definitions when using C++ */
    1.10  #ifdef __cplusplus
     2.1 --- a/include/SDL_video.h	Fri Jul 07 08:07:16 2006 +0000
     2.2 +++ b/include/SDL_video.h	Fri Jul 07 10:29:16 2006 +0000
     2.3 @@ -313,8 +313,7 @@
     2.4      SDL_GL_STEREO,
     2.5      SDL_GL_MULTISAMPLEBUFFERS,
     2.6      SDL_GL_MULTISAMPLESAMPLES,
     2.7 -    SDL_GL_ACCELERATED_VISUAL,
     2.8 -    SDL_GL_SWAP_CONTROL
     2.9 +    SDL_GL_ACCELERATED_VISUAL
    2.10  } SDL_GLattr;
    2.11  
    2.12  
    2.13 @@ -1377,6 +1376,7 @@
    2.14   * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
    2.15   *
    2.16   * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
    2.17 + *
    2.18   * \note This function uses a static buffer, and is not thread-safe.
    2.19   */
    2.20  extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
    2.21 @@ -1388,40 +1388,99 @@
    2.22  /* OpenGL support functions.                                                 */
    2.23  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2.24  
    2.25 -/*
    2.26 - * Dynamically load an OpenGL library, or the default one if path is NULL
    2.27 +/**
    2.28 + * \fn int SDL_GL_LoadLibrary(const char *path)
    2.29 + *
    2.30 + * \brief Dynamically load an OpenGL library.
    2.31 + *
    2.32 + * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
    2.33   *
    2.34 - * If you do this, you need to retrieve all of the GL functions used in
    2.35 - * your program from the dynamic library using SDL_GL_GetProcAddress().
    2.36 + * \return 0 on success, or -1 if the library couldn't be loaded
    2.37 + *
    2.38 + * \note If you do this, you need to retrieve all of the GL functions used in
    2.39 + *       your program from the dynamic library using SDL_GL_GetProcAddress().
    2.40 + *
    2.41 + * \sa SDL_GL_GetProcAddress()
    2.42   */
    2.43  extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
    2.44  
    2.45 -/*
    2.46 - * Get the address of a GL function
    2.47 +/**
    2.48 + * \fn void *SDL_GL_GetProcAddress(const char *proc)
    2.49 + *
    2.50 + * \brief Get the address of an OpenGL function.
    2.51   */
    2.52  extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
    2.53  
    2.54 -/*
    2.55 - * Set an attribute of the OpenGL subsystem before window creation.
    2.56 +/**
    2.57 + * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
    2.58 + *
    2.59 + * \brief Set an OpenGL window attribute before window creation.
    2.60   */
    2.61  extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
    2.62  
    2.63 -/*
    2.64 - * Get an attribute of the OpenGL subsystem from the windowing
    2.65 - * interface, such as glX. This is of course different from getting
    2.66 - * the values from SDL's internal OpenGL subsystem, which only
    2.67 - * stores the values you request before initialization.
    2.68 +/**
    2.69 + * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
    2.70 + *
    2.71 + * \brief Get the actual value for an OpenGL window attribute.
    2.72 + */
    2.73 +extern DECLSPEC int SDLCALL SDL_GL_GetWindowAttribute(SDL_WindowID windowID,
    2.74 +                                                      SDL_GLattr attr,
    2.75 +                                                      int *value);
    2.76 +
    2.77 +/**
    2.78 + * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID)
    2.79 + *
    2.80 + * \brief Create an OpenGL context for use with an OpenGL window, and make it current.
    2.81 + *
    2.82 + * \sa SDL_GL_DeleteContext()
    2.83 + */
    2.84 +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
    2.85 +                                                           windowID);
    2.86 +
    2.87 +/**
    2.88 + * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
    2.89 + *
    2.90 + * \brief Set up an OpenGL context for rendering into an OpenGL window.
    2.91   *
    2.92 - * Developers should track the values they pass into SDL_GL_SetAttribute
    2.93 - * themselves if they want to retrieve these values.
    2.94 + * \note The context must have been created with a compatible window.
    2.95 + */
    2.96 +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
    2.97 +                                               SDL_GLContext context);
    2.98 +
    2.99 +/**
   2.100 + * \fn int SDL_GL_SetSwapInterval(int interval)
   2.101 + *
   2.102 + * \brief Set the swap interval for the current OpenGL context.
   2.103 + *
   2.104 + * \sa SDL_GL_GetSwapInterval()
   2.105   */
   2.106 -extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
   2.107 +extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
   2.108  
   2.109 -/*
   2.110 +/**
   2.111 + * \fn int SDL_GL_GetSwapInterval(void)
   2.112 + *
   2.113 + * \brief Get the swap interval for the current OpenGL context.
   2.114 + *
   2.115 + * \sa SDL_GL_SetSwapInterval()
   2.116 + */
   2.117 +extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
   2.118 +
   2.119 +/**
   2.120 + * \fn void SDL_GL_SwapBuffers(void)
   2.121 + *
   2.122   * Swap the OpenGL buffers, if double-buffering is supported.
   2.123   */
   2.124  extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
   2.125  
   2.126 +/**
   2.127 + * \fn void SDL_GL_DeleteContext(SDL_GLContext context)
   2.128 + *
   2.129 + * \brief Delete an OpenGL context.
   2.130 + *
   2.131 + * \sa SDL_GL_CreateContext()
   2.132 + */
   2.133 +extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
   2.134 +
   2.135  /*
   2.136   * Calculate the intersection of two rectangles
   2.137   */
     3.1 --- a/src/video/win32/SDL_win32events.c	Fri Jul 07 08:07:16 2006 +0000
     3.2 +++ b/src/video/win32/SDL_win32events.c	Fri Jul 07 10:29:16 2006 +0000
     3.3 @@ -814,6 +814,12 @@
     3.4          }
     3.5          return (0);
     3.6  
     3.7 +        /* We'll do our own drawing, prevent flicker */
     3.8 +    case WM_ERASEBKGND:
     3.9 +        {
    3.10 +        }
    3.11 +        return (1);
    3.12 +
    3.13      case WM_SYSCOMMAND:
    3.14          {
    3.15              /* Don't start the screensaver or blank the monitor in fullscreen apps */