Load png Image to create texture

I created image texture brush with texture image and like water color brush. in draw method load image texture and need to load png but in my case , png image not set a image texture for draw brush

void TextureBrush::setBrushTexture(std::string textureName){
    this->textureName = textureName;

        std::string name("textures/" + this->textureName + "-" + "1" + ".png");
        this->textures.load(name);
        this->textures.getTexture().generateMipmap();
        this->textures.getTexture().setTextureMinMagFilter( GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);

    this->textureSize = this->textures[0].getWidth();
}

png available in given path when load jpg image it is OK .(OpenFramework version 11)

Hi @Prabodha_Manoranga,

Are you calling TextureBrush::setBrushTexture() in ofApp::draw()? or generally when trying to draw a TextureBrush? Sometimes loading an image in ofApp::draw() doesn’t work very well and the image needs to be loaded in ofApp::setup() (or even ofApp::update(), but it might slow down or briefly pause the application). There is also ofxThreadedImageLoader which will use a separate thread to load images.

Also, ofImage::load() returns a bool, which is true if the image has loaded properly. So you might be able to use that to see if the image is loading properly.

@ TimChi thanks for contributing!
yes now I try to in ofApp::setup() but not work jpg is OK png not working i will try to use ofxThreadedImageLoader thanks .