Fixed images and shaders sometimes not updated when they are modified while they are used

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1427 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-02-25 19:05:57 +00:00
parent 76a76a784f
commit 6f6481ef38
5 changed files with 86 additions and 24 deletions

View file

@ -37,6 +37,7 @@
namespace sf
{
class Renderer;
class RenderImage;
class RenderWindow;
@ -291,6 +292,7 @@ public :
private :
friend class Renderer;
friend class RenderImage;
////////////////////////////////////////////////////////////
@ -315,6 +317,12 @@ private :
////////////////////////////////////////////////////////////
void EnsureArrayUpdate() const;
////////////////////////////////////////////////////////////
/// Make sure that the image is ready to be used
///
////////////////////////////////////////////////////////////
void Use() const;
////////////////////////////////////////////////////////////
/// Reset the image attributes
///

View file

@ -38,6 +38,8 @@
namespace sf
{
class Renderer;
////////////////////////////////////////////////////////////
/// \brief Pixel/fragment shader class
///
@ -317,6 +319,8 @@ public :
private :
friend class Renderer;
////////////////////////////////////////////////////////////
/// \brief Create the program and attach the shaders
///
@ -325,6 +329,25 @@ private :
////////////////////////////////////////////////////////////
bool CompileProgram();
////////////////////////////////////////////////////////////
/// \brief Bind all the textures used by the shader
///
/// This function each texture to a different unit, and
/// updates the corresponding variables in the shader accordingly.
///
////////////////////////////////////////////////////////////
void BindTextures() const;
////////////////////////////////////////////////////////////
/// \brief Make sure that the shader is ready to be used
///
/// This function is called by the Renderer class, to make
/// sure that the shader's parameters are properly applied
/// even when Use() is not called due to internal optimizations.
///
////////////////////////////////////////////////////////////
void Use() const;
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////