c++ - sf::Shader and sf::RectangleShape -


i have question using sf::shape sfml graphic library. in game use sf::rectangleshapes. example userinterface or player. here peace of code:

std::unique_ptr<sf::rectangleshape> rect; sf::rendertarget &target; sf::renderstates &stats;  void sfuicomponents::sfbaserectangle::draw() {         target.draw(*rect, stats); } 

when load shader file here:

if(shader->loadfromfile(vertex, fragment)){ loaded = true;}  effect->loadfromfile("wave.vert","blur.frag");  

before draw rectangle :

void sfshader::activate() {     stats.shader = shader; } 

the text draw show effect rectangles aren't visible. ms question without showing more code. possible use sfml shader rectangles simple fill white color?

you can use shader when drawing render. can creating "sf::renderstate", , setting it's shader:

sf::renderstate rs; sf::shader effect;  effect.loadfromfile("wave.vert","blur.frag");  rs.shader = &effect;  window.draw(rect , rs); 

if don't need use more information renderstate (like texture), can directly pass shader draw function:

sf::shader effect;  effect.loadfromfile("wave.vert","blur.frag");  window.draw(rect , &effect); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -