//-------------------------------------------------------------------------------- void ofxCvImage::drawROI( float x, float y, float w, float h ) const { if( bUseTexture ) { ofRectangle roi = getROI(); if( bTextureDirty ) { tex.loadData( getRoiPixels() ); bTextureDirty = false; } tex.drawSubsection(x,y, w,h,0,0,roi.width,roi.height); } else { ofLogError("ofxCvImage") << "drawROI(): textureless drawing mode not implemented"; } }
//-------------------------------------------------------------------------------- void ofxCvImage::drawROI( float x, float y, float w, float h ) { if( bUseTexture ) { ofRectangle roi = getROI(); if( bTextureDirty ) { if(tex.getWidth() != roi.width || tex.getHeight() != roi.height) { //ROI was changed // reallocating texture - this could be faster with ROI support tex.clear(); tex.allocate( (int)roi.width, (int)roi.height, glchannels ); } tex.loadData( getRoiPixels(), (int)roi.width, (int)roi.height, glchannels ); bTextureDirty = false; } tex.draw(x,y, w,h); } else { ofLog(OF_LOG_ERROR, "texture-less drawing not implemented for drawROI"); } }