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

Commit

Permalink
Started on the OpenGL API revamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 7, 2006
1 parent 666a8a7 commit dcaf45a
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 19 deletions.
1 change: 1 addition & 0 deletions include/SDL_compat.h
Expand Up @@ -171,6 +171,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
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
Expand Down
97 changes: 78 additions & 19 deletions include/SDL_video.h
Expand Up @@ -313,8 +313,7 @@ typedef enum
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_SWAP_CONTROL
SDL_GL_ACCELERATED_VISUAL
} SDL_GLattr;


Expand Down Expand Up @@ -1377,6 +1376,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
* \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,
Expand All @@ -1388,40 +1388,99 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
/* 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
*
* \return 0 on success, or -1 if the library couldn't be loaded
*
* 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().
* \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)
*
* Developers should track the values they pass into SDL_GL_SetAttribute
* themselves if they want to retrieve these values.
* \brief Get the actual value for an OpenGL window attribute.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
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.
*
* \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_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
*/
Expand Down
6 changes: 6 additions & 0 deletions src/video/win32/SDL_win32events.c
Expand Up @@ -814,6 +814,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
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 */
Expand Down

0 comments on commit dcaf45a

Please sign in to comment.