Skip to content

Commit

Permalink
Implemented methods to retrieve the OpenGL handles from sf::Texture a…
Browse files Browse the repository at this point in the history
…nd sf::Shader.
  • Loading branch information
binary1248 committed Aug 28, 2014
1 parent 01e345b commit 1c34257
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/SFML/Graphics/Shader.hpp
Expand Up @@ -456,6 +456,18 @@ public :
////////////////////////////////////////////////////////////
void setParameter(const std::string& name, CurrentTextureType);

////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the shader.
///
/// You shouldn't need to use this function, unless you have
/// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed.
///
/// \return OpenGL handle of the shader or 0 if not yet loaded
///
////////////////////////////////////////////////////////////
unsigned int getNativeHandle() const;

////////////////////////////////////////////////////////////
/// \brief Bind a shader for rendering
///
Expand Down
12 changes: 12 additions & 0 deletions include/SFML/Graphics/Texture.hpp
Expand Up @@ -420,6 +420,18 @@ public :
////////////////////////////////////////////////////////////
Texture& operator =(const Texture& right);

////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the texture.
///
/// You shouldn't need to use this function, unless you have
/// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed.
///
/// \return OpenGL handle of the texture or 0 if not yet created
///
////////////////////////////////////////////////////////////
unsigned int getNativeHandle() const;

////////////////////////////////////////////////////////////
/// \brief Bind a texture for rendering
///
Expand Down
7 changes: 7 additions & 0 deletions src/SFML/Graphics/Shader.cpp
Expand Up @@ -458,6 +458,13 @@ void Shader::setParameter(const std::string& name, CurrentTextureType)
}


////////////////////////////////////////////////////////////
unsigned int Shader::getNativeHandle() const
{
return m_shaderProgram;
}


////////////////////////////////////////////////////////////
void Shader::bind(const Shader* shader)
{
Expand Down
7 changes: 7 additions & 0 deletions src/SFML/Graphics/Texture.cpp
Expand Up @@ -571,6 +571,13 @@ Texture& Texture::operator =(const Texture& right)
}


////////////////////////////////////////////////////////////
unsigned int Texture::getNativeHandle() const
{
return m_texture;
}


////////////////////////////////////////////////////////////
unsigned int Texture::getValidSize(unsigned int size)
{
Expand Down

0 comments on commit 1c34257

Please sign in to comment.