Separated OpenGL contexts from Window implementations

Added support for OpenGL 3.0
Replaced WindowSettings with ContextSettings
Synchronized with trunk

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1065 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-03-28 16:22:58 +00:00
commit 9c370e38da
110 changed files with 2758 additions and 2335 deletions

View file

@ -47,7 +47,7 @@
/// \param Params : Creation settings
///
////////////////////////////////////////////////////////////
CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params);
CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params);
////////////////////////////////////////////////////////////
/// Construct a renderwindow from an existing control
@ -56,7 +56,7 @@ CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Ti
/// \param Params : Creation settings
///
////////////////////////////////////////////////////////////
CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params);
CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params);
////////////////////////////////////////////////////////////
/// Destroy an existing renderwindow
@ -110,7 +110,7 @@ CSFML_API unsigned int sfRenderWindow_GetHeight(sfRenderWindow* RenderWindow);
/// \return Settings used to create the window
///
////////////////////////////////////////////////////////////
CSFML_API sfWindowSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow);
CSFML_API sfContextSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow);
////////////////////////////////////////////////////////////
/// Get the event on top of events stack of a window, if any, and pop it

View file

@ -57,7 +57,7 @@ typedef struct
unsigned int DepthBits; ///< Bits of the depth buffer
unsigned int StencilBits; ///< Bits of the stencil buffer
unsigned int AntialiasingLevel; ///< Level of antialiasing
} sfWindowSettings;
} sfContextSettings;
////////////////////////////////////////////////////////////
@ -69,7 +69,7 @@ typedef struct
/// \param Params : Creation settings
///
////////////////////////////////////////////////////////////
CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params);
CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params);
////////////////////////////////////////////////////////////
/// Construct a window from an existing control
@ -78,7 +78,7 @@ CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigne
/// \param Params : Creation settings
///
////////////////////////////////////////////////////////////
CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params);
CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params);
////////////////////////////////////////////////////////////
/// Destroy an existing window
@ -132,7 +132,7 @@ CSFML_API unsigned int sfWindow_GetHeight(sfWindow* Window);
/// \return Settings used to create the window
///
////////////////////////////////////////////////////////////
CSFML_API sfWindowSettings sfWindow_GetSettings(sfWindow* Window);
CSFML_API sfContextSettings sfWindow_GetSettings(sfWindow* Window);
////////////////////////////////////////////////////////////
/// Get the event on top of events stack of a window, if any, and pop it

View file

@ -86,14 +86,14 @@ struct sfRenderWindow
////////////////////////////////////////////////////////////
/// Construct a new renderwindow
////////////////////////////////////////////////////////////
sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params)
sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params)
{
// Convert video mode
sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel);
// Create the window
sfRenderWindow* RenderWindow = new sfRenderWindow;
sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
RenderWindow->This.Create(VideoMode, Title, Style, Settings);
RenderWindow->Input.This = &RenderWindow->This.GetInput();
RenderWindow->DefaultView.This = &RenderWindow->This.GetDefaultView();
@ -106,10 +106,10 @@ sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsig
////////////////////////////////////////////////////////////
/// Construct a renderwindow from an existing control
////////////////////////////////////////////////////////////
sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params)
sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params)
{
sfRenderWindow* RenderWindow = new sfRenderWindow;
sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
RenderWindow->This.Create(Handle, Settings);
RenderWindow->Input.This = &RenderWindow->This.GetInput();
RenderWindow->DefaultView.This = &RenderWindow->This.GetDefaultView();
@ -166,12 +166,12 @@ unsigned int sfRenderWindow_GetHeight(sfRenderWindow* RenderWindow)
////////////////////////////////////////////////////////////
/// Get the creation settings of a window
////////////////////////////////////////////////////////////
sfWindowSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow)
sfContextSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow)
{
sfWindowSettings Settings = {0, 0, 0};
sfContextSettings Settings = {0, 0, 0};
CSFML_CHECK_RETURN(RenderWindow, Settings);
const sf::WindowSettings& Params = RenderWindow->This.GetSettings();
const sf::ContextSettings& Params = RenderWindow->This.GetSettings();
Settings.DepthBits = Params.DepthBits;
Settings.StencilBits = Params.StencilBits;
Settings.AntialiasingLevel = Params.AntialiasingLevel;

View file

@ -3,8 +3,7 @@ export CPP = g++
export CFLAGS = -W -Wall -pedantic -fPIC -Wno-unused -I../.. -I../../../include -DNDEBUG -DCSFML_EXPORTS -O2
export LDFLAGS = -shared
export LIBPATH = ../../../lib
export VERSION = 2.0
export CP = cp
export VERSION = 2.0export CP = cp
export LN = ln
export LNFLAGS = -s -f
export DESTDIR = /usr

View file

@ -32,7 +32,11 @@
struct sfContext
{
sf::Context This;
sfContext() : This(sf::Context::New()) {}
~sfContext() {delete This;}
sf::Context* This;
};
@ -59,5 +63,5 @@ void sfContext_Destroy(sfContext* Context)
////////////////////////////////////////////////////////////
void sfContext_SetActive(sfContext* Context, sfBool Active)
{
CSFML_CALL(Context, SetActive(Active == sfTrue))
CSFML_CALL_PTR(Context, SetActive(Active == sfTrue))
}

View file

@ -46,14 +46,14 @@ struct sfWindow
////////////////////////////////////////////////////////////
/// Construct a new window
////////////////////////////////////////////////////////////
sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params)
sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params)
{
// Convert video mode
sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel);
// Create the window
sfWindow* Window = new sfWindow;
sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
Window->This.Create(VideoMode, Title, Style, Settings);
Window->Input.This = &Window->This.GetInput();
@ -64,10 +64,10 @@ sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Sty
////////////////////////////////////////////////////////////
/// Construct a window from an existing control
////////////////////////////////////////////////////////////
sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params)
sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params)
{
sfWindow* Window = new sfWindow;
sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel);
Window->This.Create(Handle, Settings);
Window->Input.This = &Window->This.GetInput();
@ -122,12 +122,12 @@ unsigned int sfWindow_GetHeight(sfWindow* Window)
////////////////////////////////////////////////////////////
/// Get the creation settings of a window
////////////////////////////////////////////////////////////
sfWindowSettings sfWindow_GetSettings(sfWindow* Window)
sfContextSettings sfWindow_GetSettings(sfWindow* Window)
{
sfWindowSettings Settings = {0, 0, 0};
sfContextSettings Settings = {0, 0, 0};
CSFML_CHECK_RETURN(Window, Settings);
const sf::WindowSettings& Params = Window->This.GetSettings();
const sf::ContextSettings& Params = Window->This.GetSettings();
Settings.DepthBits = Params.DepthBits;
Settings.StencilBits = Params.StencilBits;
Settings.AntialiasingLevel = Params.AntialiasingLevel;