OK, so I made "std::string myFragmentShader" in "SFML/Graphics/Shader.hpp" public, and it is working, but not correctly.
Here's what I'm doing in my main file:
case sf::Keyboard::L:
// clearing the shader string
ShaderMain.myFragmentShader.clear();
// loading
if (ShaderMain.LoadFromFile(gfx.ShaderMainFile))
ShaderIsValid = true;
else
ShaderIsValid = false;
// this checks out
cout << ShaderMain.myFragmentShader;
break;
For testing purposes I am using a noise shader that just fills the screen with random values. I'm feeding it a random number to offset the noise to behave like TV static. There is a uniform sampler declared in the shader that isn't being used in the C++ program, so I know that the shader was loaded successfully when I see an error pertaining to said unused uniform sampler. If an attempt to load the shader fails, the screen will go blank.
When reloading the shader, strange things are occurring:
- I do not receive an error about the unused uniform sampler
- the screen isn't going blank like it would if the shader couldn't be loaded
- the static suddenly stands still, as if the parameter I am feeding it isn't changing
- the program continues happily as if nothing is wrong
Was it a bad idea to make myFragmentShader public?