Renamed internal classes related to OpenGL contexts in the window module
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1501 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
51ff7296ad
commit
a512479a42
@ -117,19 +117,18 @@
|
|||||||
<Unit filename="..\..\include\SFML\Window\Window.hpp" />
|
<Unit filename="..\..\include\SFML\Window\Window.hpp" />
|
||||||
<Unit filename="..\..\include\SFML\Window\WindowHandle.hpp" />
|
<Unit filename="..\..\include\SFML\Window\WindowHandle.hpp" />
|
||||||
<Unit filename="..\..\include\SFML\Window\WindowStyle.hpp" />
|
<Unit filename="..\..\include\SFML\Window\WindowStyle.hpp" />
|
||||||
<Unit filename="..\..\include\SFML\Window\glew\glew.h" />
|
|
||||||
<Unit filename="..\..\src\SFML\Window\Context.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Context.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\ContextGL.cpp" />
|
<Unit filename="..\..\src\SFML\Window\GlContext.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\ContextGL.hpp" />
|
<Unit filename="..\..\src\SFML\Window\GlContext.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Input.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Input.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Joystick.hpp" />
|
<Unit filename="..\..\src\SFML\Window\Joystick.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\VideoMode.cpp" />
|
<Unit filename="..\..\src\SFML\Window\VideoMode.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\VideoModeImpl.hpp" />
|
<Unit filename="..\..\src\SFML\Window\VideoModeImpl.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\ContextWGL.cpp" />
|
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\ContextWGL.hpp" />
|
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\Joystick.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Win32\Joystick.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\Joystick.hpp" />
|
<Unit filename="..\..\src\SFML\Window\Win32\Joystick.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp" />
|
||||||
|
<Unit filename="..\..\src\SFML\Window\Win32\WglContext.cpp" />
|
||||||
|
<Unit filename="..\..\src\SFML\Window\Win32\WglContext.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Win32\WindowImplWin32.hpp" />
|
<Unit filename="..\..\src\SFML\Window\Win32\WindowImplWin32.hpp" />
|
||||||
<Unit filename="..\..\src\SFML\Window\Window.cpp" />
|
<Unit filename="..\..\src\SFML\Window\Window.cpp" />
|
||||||
|
@ -351,14 +351,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Win32"
|
Name="Win32"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\ContextWGL.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\ContextWGL.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\Joystick.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\Joystick.cpp"
|
||||||
>
|
>
|
||||||
@ -403,6 +395,14 @@
|
|||||||
RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\Win32\WglContext.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\Win32\WglContext.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp"
|
||||||
>
|
>
|
||||||
@ -452,14 +452,6 @@
|
|||||||
RelativePath="..\..\include\SFML\Window\Context.hpp"
|
RelativePath="..\..\include\SFML\Window\Context.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\ContextGL.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\ContextGL.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\SFML\Window\ContextSettings.hpp"
|
RelativePath="..\..\include\SFML\Window\ContextSettings.hpp"
|
||||||
>
|
>
|
||||||
@ -468,6 +460,14 @@
|
|||||||
RelativePath="..\..\include\SFML\Window\Event.hpp"
|
RelativePath="..\..\include\SFML\Window\Event.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\GlContext.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\GlContext.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Input.cpp"
|
RelativePath="..\..\src\SFML\Window\Input.cpp"
|
||||||
>
|
>
|
||||||
|
@ -346,14 +346,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Win32"
|
Name="Win32"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\ContextWGL.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\ContextWGL.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\Joystick.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\Joystick.cpp"
|
||||||
>
|
>
|
||||||
@ -366,6 +358,14 @@
|
|||||||
RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\Win32\WglContext.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\Win32\WglContext.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp"
|
RelativePath="..\..\src\SFML\Window\Win32\WindowImplWin32.cpp"
|
||||||
>
|
>
|
||||||
@ -415,14 +415,6 @@
|
|||||||
RelativePath="..\..\include\SFML\Window\Context.hpp"
|
RelativePath="..\..\include\SFML\Window\Context.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\ContextGL.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\SFML\Window\ContextGL.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\SFML\Window\ContextSettings.hpp"
|
RelativePath="..\..\include\SFML\Window\ContextSettings.hpp"
|
||||||
>
|
>
|
||||||
@ -431,6 +423,14 @@
|
|||||||
RelativePath="..\..\include\SFML\Window\Event.hpp"
|
RelativePath="..\..\include\SFML\Window\Event.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\GlContext.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\SFML\Window\GlContext.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\SFML\Window\Input.cpp"
|
RelativePath="..\..\src\SFML\Window\Input.cpp"
|
||||||
>
|
>
|
||||||
|
@ -36,7 +36,7 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
class ContextGL;
|
class GlContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -88,7 +88,7 @@ private :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
priv::ContextGL* myContext; ///< Internal OpenGL context
|
priv::GlContext* myContext; ///< Internal OpenGL context
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Window/ContextSettings.hpp>
|
||||||
#include <SFML/Window/Input.hpp>
|
#include <SFML/Window/Input.hpp>
|
||||||
#include <SFML/Window/VideoMode.hpp>
|
#include <SFML/Window/VideoMode.hpp>
|
||||||
#include <SFML/Window/WindowHandle.hpp>
|
#include <SFML/Window/WindowHandle.hpp>
|
||||||
#include <SFML/Window/ContextSettings.hpp>
|
|
||||||
#include <SFML/Window/WindowStyle.hpp>
|
#include <SFML/Window/WindowStyle.hpp>
|
||||||
#include <SFML/System/Clock.hpp>
|
#include <SFML/System/Clock.hpp>
|
||||||
#include <SFML/System/NonCopyable.hpp>
|
#include <SFML/System/NonCopyable.hpp>
|
||||||
@ -42,8 +42,8 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
|
class GlContext;
|
||||||
class WindowImpl;
|
class WindowImpl;
|
||||||
class ContextGL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Event;
|
class Event;
|
||||||
@ -470,7 +470,7 @@ private :
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
priv::WindowImpl* myWindow; ///< Platform-specific implementation of the window
|
priv::WindowImpl* myWindow; ///< Platform-specific implementation of the window
|
||||||
priv::ContextGL* myContext; ///< Platform-specific implementation of the OpenGL context
|
priv::GlContext* myContext; ///< Platform-specific implementation of the OpenGL context
|
||||||
Input myInput; ///< Input manager connected to window
|
Input myInput; ///< Input manager connected to window
|
||||||
Clock myClock; ///< Clock for measuring the elapsed time between frames
|
Clock myClock; ///< Clock for measuring the elapsed time between frames
|
||||||
float myLastFrameTime; ///< Time elapsed since last frame
|
float myLastFrameTime; ///< Time elapsed since last frame
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Context.hpp>
|
#include <SFML/Window/Context.hpp>
|
||||||
#include <SFML/Window/ContextGL.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
@ -34,7 +34,7 @@ namespace sf
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Context::Context()
|
Context::Context()
|
||||||
{
|
{
|
||||||
myContext = priv::ContextGL::New();
|
myContext = priv::GlContext::New();
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ void Context::SetActive(bool active)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Context::SetReferenceActive()
|
bool Context::SetReferenceActive()
|
||||||
{
|
{
|
||||||
return priv::ContextGL::SetReferenceActive();
|
return priv::GlContext::SetReferenceActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/ContextGL.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
#include <SFML/System/ThreadLocalPtr.hpp>
|
#include <SFML/System/ThreadLocalPtr.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <SFML/Window/glext/glext.h>
|
#include <SFML/Window/glext/glext.h>
|
||||||
@ -34,18 +34,18 @@
|
|||||||
|
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
#if defined(SFML_SYSTEM_WINDOWS)
|
||||||
|
|
||||||
#include <SFML/Window/Win32/ContextWGL.hpp>
|
#include <SFML/Window/Win32/WglContext.hpp>
|
||||||
typedef sf::priv::ContextWGL ContextType;
|
typedef sf::priv::WglContext ContextType;
|
||||||
|
|
||||||
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
|
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
|
||||||
|
|
||||||
#include <SFML/Window/Linux/ContextGLX.hpp>
|
#include <SFML/Window/Linux/GlxContext.hpp>
|
||||||
typedef sf::priv::ContextGLX ContextType;
|
typedef sf::priv::GlxContext ContextType;
|
||||||
|
|
||||||
#elif defined(SFML_SYSTEM_MACOS)
|
#elif defined(SFML_SYSTEM_MACOS)
|
||||||
|
|
||||||
#include <SFML/Window/Cocoa/ContextAGL.hpp>
|
#include <SFML/Window/Cocoa/AglContext.hpp>
|
||||||
typedef sf::priv::ContextAGL ContextType;
|
typedef sf::priv::AglContext ContextType;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,7 +56,7 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// This thread-local variable will hold the "global" context for each thread
|
// This thread-local variable will hold the "global" context for each thread
|
||||||
sf::ThreadLocalPtr<sf::priv::ContextGL> threadContext(NULL);
|
sf::ThreadLocalPtr<sf::priv::GlContext> threadContext(NULL);
|
||||||
|
|
||||||
// Now we create two global contexts.
|
// Now we create two global contexts.
|
||||||
// The first one is the reference context: it will be shared with every other
|
// The first one is the reference context: it will be shared with every other
|
||||||
@ -73,14 +73,14 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL* ContextGL::New()
|
GlContext* GlContext::New()
|
||||||
{
|
{
|
||||||
return new ContextType(&referenceContext);
|
return new ContextType(&referenceContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
|
GlContext* GlContext::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings);
|
ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings);
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, co
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL::~ContextGL()
|
GlContext::~GlContext()
|
||||||
{
|
{
|
||||||
if (threadContext == this)
|
if (threadContext == this)
|
||||||
{
|
{
|
||||||
@ -108,14 +108,14 @@ ContextGL::~ContextGL()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const ContextSettings& ContextGL::GetSettings() const
|
const ContextSettings& GlContext::GetSettings() const
|
||||||
{
|
{
|
||||||
return mySettings;
|
return mySettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGL::SetActive(bool active)
|
bool GlContext::SetActive(bool active)
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ bool ContextGL::SetActive(bool active)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGL::SetReferenceActive()
|
bool GlContext::SetReferenceActive()
|
||||||
{
|
{
|
||||||
if (threadContext)
|
if (threadContext)
|
||||||
return threadContext->SetActive(true);
|
return threadContext->SetActive(true);
|
||||||
@ -158,14 +158,14 @@ bool ContextGL::SetReferenceActive()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL::ContextGL()
|
GlContext::GlContext()
|
||||||
{
|
{
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int ContextGL::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
|
int GlContext::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
|
||||||
{
|
{
|
||||||
return abs(static_cast<int>(bitsPerPixel - colorBits)) +
|
return abs(static_cast<int>(bitsPerPixel - colorBits)) +
|
||||||
abs(static_cast<int>(settings.DepthBits - depthBits)) +
|
abs(static_cast<int>(settings.DepthBits - depthBits)) +
|
@ -22,8 +22,8 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_CONTEXTGL_HPP
|
#ifndef SFML_GLCONTEXT_HPP
|
||||||
#define SFML_CONTEXTGL_HPP
|
#define SFML_GLCONTEXT_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
@ -43,7 +43,7 @@ class WindowImpl;
|
|||||||
/// \brief Abstract class representing an OpenGL context
|
/// \brief Abstract class representing an OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextGL : NonCopyable
|
class GlContext : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public :
|
|||||||
/// \return Pointer to the created context (don't forget to delete it)
|
/// \return Pointer to the created context (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static ContextGL* New();
|
static GlContext* New();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
@ -71,7 +71,7 @@ public :
|
|||||||
/// \return Pointer to the created context (don't forget to delete it)
|
/// \return Pointer to the created context (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static ContextGL* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
static GlContext* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public :
|
|||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual ~ContextGL();
|
virtual ~GlContext();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the settings of the context
|
/// \brief Get the settings of the context
|
||||||
@ -149,7 +149,7 @@ protected :
|
|||||||
/// This constructor is meant for derived classes only.
|
/// This constructor is meant for derived classes only.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL();
|
GlContext();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Activate the context as the current target
|
/// \brief Activate the context as the current target
|
||||||
@ -191,4 +191,4 @@ protected :
|
|||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_CONTEXTGL_HPP
|
#endif // SFML_GLCONTEXT_HPP
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#define GLX_GLXEXT_LEGACY // so that our local glxext.h is used instead of the system one
|
#define GLX_GLXEXT_LEGACY // so that our local glxext.h is used instead of the system one
|
||||||
#include <SFML/Window/Linux/ContextGLX.hpp>
|
#include <SFML/Window/Linux/GlxContext.hpp>
|
||||||
#include <SFML/Window/Linux/WindowImplX11.hpp>
|
#include <SFML/Window/Linux/WindowImplX11.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <SFML/Window/glext/glxext.h>
|
#include <SFML/Window/glext/glxext.h>
|
||||||
@ -38,7 +38,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX::ContextGLX(ContextGLX* shared) :
|
GlxContext::GlxContext(GlxContext* shared) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
myContext (NULL),
|
myContext (NULL),
|
||||||
myOwnsWindow(true)
|
myOwnsWindow(true)
|
||||||
@ -67,7 +67,7 @@ myOwnsWindow(true)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX::ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
GlxContext::GlxContext(GlxContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
myContext (NULL),
|
myContext (NULL),
|
||||||
myOwnsWindow(false)
|
myOwnsWindow(false)
|
||||||
@ -88,7 +88,7 @@ myOwnsWindow(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX::~ContextGLX()
|
GlxContext::~GlxContext()
|
||||||
{
|
{
|
||||||
// Destroy the context
|
// Destroy the context
|
||||||
if (myContext)
|
if (myContext)
|
||||||
@ -114,7 +114,7 @@ ContextGLX::~ContextGLX()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGLX::MakeCurrent()
|
bool GlxContext::MakeCurrent()
|
||||||
{
|
{
|
||||||
if (myContext)
|
if (myContext)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ bool ContextGLX::MakeCurrent()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::Display()
|
void GlxContext::Display()
|
||||||
{
|
{
|
||||||
if (myWindow)
|
if (myWindow)
|
||||||
glXSwapBuffers(myDisplay, myWindow);
|
glXSwapBuffers(myDisplay, myWindow);
|
||||||
@ -139,7 +139,7 @@ void ContextGLX::Display()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::UseVerticalSync(bool enabled)
|
void GlxContext::UseVerticalSync(bool enabled)
|
||||||
{
|
{
|
||||||
const GLubyte* name = reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI");
|
const GLubyte* name = reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI");
|
||||||
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress(name));
|
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress(name));
|
||||||
@ -149,7 +149,7 @@ void ContextGLX::UseVerticalSync(bool enabled)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
void GlxContext::CreateContext(GlxContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
// Save the creation settings
|
// Save the creation settings
|
||||||
mySettings = settings;
|
mySettings = settings;
|
@ -22,13 +22,13 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_CONTEXTGLX_HPP
|
#ifndef SFML_GLXCONTEXT_HPP
|
||||||
#define SFML_CONTEXTGLX_HPP
|
#define SFML_GLXCONTEXT_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/ContextGL.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace priv
|
|||||||
/// \brief Linux (GLX) implementation of OpenGL contexts
|
/// \brief Linux (GLX) implementation of OpenGL contexts
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextGLX : public ContextGL
|
class GlxContext : public GlContext
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public :
|
|||||||
/// \param shared Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX(ContextGLX* shared);
|
GlxContext(GlxContext* shared);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
@ -62,13 +62,13 @@ public :
|
|||||||
/// \param settings Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
GlxContext(GlxContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~ContextGLX();
|
~GlxContext();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Activate the context as the current target
|
/// \brief Activate the context as the current target
|
||||||
@ -108,7 +108,7 @@ private :
|
|||||||
/// \param settings Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
void CreateContext(GlxContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
@ -123,4 +123,4 @@ private :
|
|||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
#endif // SFML_CONTEXTGLX_HPP
|
#endif // SFML_GLXCONTEXT_HPP
|
@ -25,7 +25,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Win32/ContextWGL.hpp>
|
#include <SFML/Window/Win32/WglContext.hpp>
|
||||||
#include <SFML/Window/WindowImpl.hpp>
|
#include <SFML/Window/WindowImpl.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <SFML/Window/glext/wglext.h>
|
#include <SFML/Window/glext/wglext.h>
|
||||||
@ -39,7 +39,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL::ContextWGL(ContextWGL* shared) :
|
WglContext::WglContext(WglContext* shared) :
|
||||||
myWindow (NULL),
|
myWindow (NULL),
|
||||||
myDeviceContext(NULL),
|
myDeviceContext(NULL),
|
||||||
myContext (NULL),
|
myContext (NULL),
|
||||||
@ -64,7 +64,7 @@ myOwnsWindow (true)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL::ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
WglContext::WglContext(WglContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
||||||
myWindow (NULL),
|
myWindow (NULL),
|
||||||
myDeviceContext(NULL),
|
myDeviceContext(NULL),
|
||||||
myContext (NULL),
|
myContext (NULL),
|
||||||
@ -84,7 +84,7 @@ myOwnsWindow (false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL::~ContextWGL()
|
WglContext::~WglContext()
|
||||||
{
|
{
|
||||||
// Destroy the OpenGL context
|
// Destroy the OpenGL context
|
||||||
if (myContext)
|
if (myContext)
|
||||||
@ -105,7 +105,7 @@ ContextWGL::~ContextWGL()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextWGL::MakeCurrent()
|
bool WglContext::MakeCurrent()
|
||||||
{
|
{
|
||||||
if (myDeviceContext && myContext)
|
if (myDeviceContext && myContext)
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ bool ContextWGL::MakeCurrent()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::Display()
|
void WglContext::Display()
|
||||||
{
|
{
|
||||||
if (myDeviceContext && myContext)
|
if (myDeviceContext && myContext)
|
||||||
SwapBuffers(myDeviceContext);
|
SwapBuffers(myDeviceContext);
|
||||||
@ -130,7 +130,7 @@ void ContextWGL::Display()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::UseVerticalSync(bool enabled)
|
void WglContext::UseVerticalSync(bool enabled)
|
||||||
{
|
{
|
||||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast<PFNWGLSWAPINTERVALEXTPROC>(wglGetProcAddress("wglSwapIntervalEXT"));
|
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast<PFNWGLSWAPINTERVALEXTPROC>(wglGetProcAddress("wglSwapIntervalEXT"));
|
||||||
if (wglSwapIntervalEXT)
|
if (wglSwapIntervalEXT)
|
||||||
@ -139,7 +139,7 @@ void ContextWGL::UseVerticalSync(bool enabled)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
void WglContext::CreateContext(WglContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
// Save the creation settings
|
// Save the creation settings
|
||||||
mySettings = settings;
|
mySettings = settings;
|
@ -22,13 +22,13 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_CONTEXTWGL_HPP
|
#ifndef SFML_WGLCONTEXT_HPP
|
||||||
#define SFML_CONTEXTWGL_HPP
|
#define SFML_WGLCONTEXT_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/ContextGL.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace priv
|
|||||||
/// \brief Windows (WGL) implementation of OpenGL contexts
|
/// \brief Windows (WGL) implementation of OpenGL contexts
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextWGL : public ContextGL
|
class WglContext : public GlContext
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public :
|
|||||||
/// \param shared Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL(ContextWGL* shared);
|
WglContext(WglContext* shared);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
@ -61,13 +61,13 @@ public :
|
|||||||
/// \param settings Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
WglContext(WglContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~ContextWGL();
|
~WglContext();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Activate the context as the current target
|
/// \brief Activate the context as the current target
|
||||||
@ -107,7 +107,7 @@ private :
|
|||||||
/// \param settings Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
void CreateContext(WglContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
@ -122,4 +122,4 @@ private :
|
|||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
#endif // SFML_CONTEXTWGL_HPP
|
#endif // SFML_WGLCONTEXT_HPP
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Window.hpp>
|
#include <SFML/Window/Window.hpp>
|
||||||
#include <SFML/Window/ContextGL.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
#include <SFML/Window/WindowImpl.hpp>
|
#include <SFML/Window/WindowImpl.hpp>
|
||||||
#include <SFML/System/Sleep.hpp>
|
#include <SFML/System/Sleep.hpp>
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
@ -129,7 +129,7 @@ void Window::Create(VideoMode mode, const std::string& title, unsigned long styl
|
|||||||
myWindow = priv::WindowImpl::New(mode, title, style);
|
myWindow = priv::WindowImpl::New(mode, title, style);
|
||||||
|
|
||||||
// Recreate the context
|
// Recreate the context
|
||||||
myContext = priv::ContextGL::New(myWindow, mode.BitsPerPixel, settings);
|
myContext = priv::GlContext::New(myWindow, mode.BitsPerPixel, settings);
|
||||||
|
|
||||||
// Perform common initializations
|
// Perform common initializations
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -146,7 +146,7 @@ void Window::Create(WindowHandle handle, const ContextSettings& settings)
|
|||||||
myWindow = priv::WindowImpl::New(handle);
|
myWindow = priv::WindowImpl::New(handle);
|
||||||
|
|
||||||
// Recreate the context
|
// Recreate the context
|
||||||
myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, settings);
|
myContext = priv::GlContext::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, settings);
|
||||||
|
|
||||||
// Perform common initializations
|
// Perform common initializations
|
||||||
Initialize();
|
Initialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user