Fixed endless loop when creating an OpenGL 3.x context (bug introduced by the last modification)

Updated the API documentation of the graphics module

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1302 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-12-03 16:47:56 +00:00
parent 148626ed5b
commit a8a3b423bf
7 changed files with 294 additions and 89 deletions

View file

@ -44,8 +44,6 @@ const Color Color::Magenta(255, 0, 255);
const Color Color::Cyan(0, 255, 255);
////////////////////////////////////////////////////////////
/// Default constructor
////////////////////////////////////////////////////////////
Color::Color() :
r(0),
@ -57,8 +55,6 @@ a(255)
}
////////////////////////////////////////////////////////////
/// Construct the color from its 4 RGBA components
////////////////////////////////////////////////////////////
Color::Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) :
r(red),
@ -70,8 +66,6 @@ a(alpha)
}
////////////////////////////////////////////////////////////
/// Compare two colors (for equality)
////////////////////////////////////////////////////////////
bool operator ==(const Color& left, const Color& right)
{
@ -82,8 +76,6 @@ bool operator ==(const Color& left, const Color& right)
}
////////////////////////////////////////////////////////////
/// Compare two colors (for difference)
////////////////////////////////////////////////////////////
bool operator !=(const Color& left, const Color& right)
{
@ -91,8 +83,6 @@ bool operator !=(const Color& left, const Color& right)
}
////////////////////////////////////////////////////////////
/// Operator + overload to add two colors
////////////////////////////////////////////////////////////
Color operator +(const Color& left, const Color& right)
{
@ -103,8 +93,6 @@ Color operator +(const Color& left, const Color& right)
}
////////////////////////////////////////////////////////////
/// Operator * overload to modulate two colors
////////////////////////////////////////////////////////////
Color operator *(const Color& left, const Color& right)
{
@ -115,8 +103,6 @@ Color operator *(const Color& left, const Color& right)
}
////////////////////////////////////////////////////////////
/// Operator += overload to add a color
////////////////////////////////////////////////////////////
Color& operator +=(Color& left, const Color& right)
{
@ -124,8 +110,6 @@ Color& operator +=(Color& left, const Color& right)
}
////////////////////////////////////////////////////////////
/// Operator *= overload to modulate a color
////////////////////////////////////////////////////////////
Color& operator *=(Color& left, const Color& right)
{

View file

@ -35,16 +35,12 @@
namespace sf
{
////////////////////////////////////////////////////////////
/// Default constructor
////////////////////////////////////////////////////////////
RenderWindow::RenderWindow()
{
// Nothing to do
}
////////////////////////////////////////////////////////////
/// Construct the window
////////////////////////////////////////////////////////////
RenderWindow::RenderWindow(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings)
{
@ -53,8 +49,6 @@ RenderWindow::RenderWindow(VideoMode mode, const std::string& title, unsigned lo
}
////////////////////////////////////////////////////////////
/// Construct the window from an existing control
////////////////////////////////////////////////////////////
RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings)
{
@ -63,8 +57,6 @@ RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings)
}
////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////
RenderWindow::~RenderWindow()
{
@ -72,8 +64,6 @@ RenderWindow::~RenderWindow()
}
////////////////////////////////////////////////////////////
/// /see RenderTarget::Activate
////////////////////////////////////////////////////////////
bool RenderWindow::Activate(bool active)
{
@ -82,8 +72,6 @@ bool RenderWindow::Activate(bool active)
}
////////////////////////////////////////////////////////////
/// Get the width of the rendering region of the window
////////////////////////////////////////////////////////////
unsigned int RenderWindow::GetWidth() const
{
@ -91,8 +79,6 @@ unsigned int RenderWindow::GetWidth() const
}
////////////////////////////////////////////////////////////
/// Get the height of the rendering region of the window
////////////////////////////////////////////////////////////
unsigned int RenderWindow::GetHeight() const
{
@ -100,8 +86,6 @@ unsigned int RenderWindow::GetHeight() const
}
////////////////////////////////////////////////////////////
/// Called after the window has been created
////////////////////////////////////////////////////////////
void RenderWindow::OnCreate()
{
@ -110,8 +94,6 @@ void RenderWindow::OnCreate()
}
////////////////////////////////////////////////////////////
/// Called before the window has been displayed
////////////////////////////////////////////////////////////
void RenderWindow::OnDisplay()
{

View file

@ -247,7 +247,7 @@ void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, co
GLXContext toShare = shared ? shared->myContext : NULL;
// Create the OpenGL context -- first try an OpenGL 3.0 context if it is requested
while (mySettings.MajorVersion >= 3)
while (!myContext && (mySettings.MajorVersion >= 3))
{
const GLubyte* name = reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB");
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = reinterpret_cast<PFNGLXCREATECONTEXTATTRIBSARBPROC>(glXGetProcAddress(name));

View file

@ -270,7 +270,7 @@ void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, co
HGLRC sharedContext = shared ? shared->myContext : NULL;
// Create the OpenGL context -- first try an OpenGL 3.0 context if it is requested
while (mySettings.MajorVersion >= 3)
while (!myContext && (mySettings.MajorVersion >= 3))
{
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribsARB"));
if (wglCreateContextAttribsARB)