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:
parent
39208efb55
commit
2df9abf341
7 changed files with 69 additions and 55 deletions
|
@ -98,7 +98,7 @@ RenderTarget::~RenderTarget()
|
|||
////////////////////////////////////////////////////////////
|
||||
void RenderTarget::clear(const Color& color)
|
||||
{
|
||||
if (activate(true))
|
||||
if (setActive(true))
|
||||
{
|
||||
// Unbind texture to fix RenderTexture preventing clear
|
||||
applyTexture(NULL);
|
||||
|
@ -214,7 +214,7 @@ void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount,
|
|||
#define GL_QUADS 0
|
||||
#endif
|
||||
|
||||
if (activate(true))
|
||||
if (setActive(true))
|
||||
{
|
||||
// First set the persistent OpenGL states if it's the very first call
|
||||
if (!m_cache.glStatesSet)
|
||||
|
@ -304,7 +304,7 @@ void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount,
|
|||
////////////////////////////////////////////////////////////
|
||||
void RenderTarget::pushGLStates()
|
||||
{
|
||||
if (activate(true))
|
||||
if (setActive(true))
|
||||
{
|
||||
#ifdef SFML_DEBUG
|
||||
// make sure that the user didn't leave an unchecked OpenGL error
|
||||
|
@ -336,7 +336,7 @@ void RenderTarget::pushGLStates()
|
|||
////////////////////////////////////////////////////////////
|
||||
void RenderTarget::popGLStates()
|
||||
{
|
||||
if (activate(true))
|
||||
if (setActive(true))
|
||||
{
|
||||
glCheck(glMatrixMode(GL_PROJECTION));
|
||||
glCheck(glPopMatrix());
|
||||
|
@ -358,7 +358,7 @@ void RenderTarget::resetGLStates()
|
|||
// Check here to make sure a context change does not happen after activate(true)
|
||||
bool shaderAvailable = Shader::isAvailable();
|
||||
|
||||
if (activate(true))
|
||||
if (setActive(true))
|
||||
{
|
||||
// Make sure that extensions are initialized
|
||||
priv::ensureExtensionsInit();
|
||||
|
|
|
@ -156,11 +156,4 @@ const Texture& RenderTexture::getTexture() const
|
|||
return m_texture;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool RenderTexture::activate(bool active)
|
||||
{
|
||||
return setActive(active);
|
||||
}
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -62,16 +62,16 @@ RenderWindow::~RenderWindow()
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool RenderWindow::activate(bool active)
|
||||
Vector2u RenderWindow::getSize() const
|
||||
{
|
||||
return setActive(active);
|
||||
return Window::getSize();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2u RenderWindow::getSize() const
|
||||
bool RenderWindow::setActive(bool active)
|
||||
{
|
||||
return Window::getSize();
|
||||
return Window::setActive(active);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue