diff --git a/bindings/c/include/SFML/Graphics/Shader.h b/bindings/c/include/SFML/Graphics/Shader.h index ab02d433..8d6ab360 100644 --- a/bindings/c/include/SFML/Graphics/Shader.h +++ b/bindings/c/include/SFML/Graphics/Shader.h @@ -115,11 +115,20 @@ CSFML_API void sfShader_SetParameter4(sfShader* shader, const char* name, float /// /// \param shader : Shader to modify /// \param name : Texture name in the effect -/// \param texture : Image to set (pass NULL to use the texture of the object being drawn) +/// \param texture : Image to set /// //////////////////////////////////////////////////////////// CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture); +//////////////////////////////////////////////////////////// +/// Set the current texture parameter in a shader +/// +/// \param shader : Shader to modify +/// \param name : Texture name in the effect +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShader_SetCurrentTexture(sfShader* shader, const char* name); + //////////////////////////////////////////////////////////// /// Bind a shader for rendering /// diff --git a/bindings/c/src/SFML/Graphics/Shader.cpp b/bindings/c/src/SFML/Graphics/Shader.cpp index 3756d106..acc93e94 100644 --- a/bindings/c/src/SFML/Graphics/Shader.cpp +++ b/bindings/c/src/SFML/Graphics/Shader.cpp @@ -126,7 +126,17 @@ void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y //////////////////////////////////////////////////////////// void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture) { - CSFML_CALL(shader, SetTexture(name, texture && texture->This ? *texture->This : sf::Shader::CurrentTexture)) + CSFML_CHECK(texture); + CSFML_CALL(shader, SetTexture(name, *texture->This)) +} + + +//////////////////////////////////////////////////////////// +/// Set the current texture parameter in a shader +//////////////////////////////////////////////////////////// +void sfShader_SetCurrentTexture(sfShader* shader, const char* name) +{ + CSFML_CALL(shader, SetCurrentTexture(name)) }