Added missing setActive virtual method to sf::RenderTarget, added setActive calls to OpenGL example to demonstrate proper explicit context management.

This commit is contained in:
binary1248 2016-10-06 23:44:56 +02:00 committed by Lukas Dürrenberger
parent 39208efb55
commit 2df9abf341
7 changed files with 69 additions and 55 deletions

View file

@ -112,6 +112,24 @@ public:
////////////////////////////////////////////////////////////
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate the window as the current target
/// for OpenGL rendering
///
/// A window is active only on the current thread, if you want to
/// make it active on another thread you have to deactivate it
/// on the previous thread first if it was active.
/// Only one window can be active on a thread at a time, thus
/// the window previously active (if any) automatically gets deactivated.
/// This is not to be confused with requestFocus().
///
/// \param active True to activate, false to deactivate
///
/// \return True if operation was successful, false otherwise
///
////////////////////////////////////////////////////////////
bool setActive(bool active = true);
////////////////////////////////////////////////////////////
/// \brief Copy the current contents of the window to an image
///
@ -159,18 +177,6 @@ protected:
///
////////////////////////////////////////////////////////////
virtual void onResize();
private:
////////////////////////////////////////////////////////////
/// \brief Activate the target for rendering
///
/// \param active True to make the target active, false to deactivate it
///
/// \return True if the function succeeded
///
////////////////////////////////////////////////////////////
virtual bool activate(bool active);
};
} // namespace sf