throwstd::runtime_error("Error: Couldn't generate mipmaps, width or height not power of two.");
}
}
if(image.type()==CV_8UC3)
{
image.convertTo(image,CV_8UC4);// Most often, the input img is CV_8UC3. Img is BGR. Add an alpha channel
cv::cvtColor(image,image,CV_BGR2BGRA);
}
intcurrWidth=image.cols;
intcurrHeight=image.rows;
for(inti=0;i<this->mipmaps_num;i++)
std::vector<cv::Mat>mipmaps;
for(inti=0;i<texture.mipmaps_num;i++)
{
if(i==0){
mipmaps.push_back(image);
...
...
@@ -193,16 +208,12 @@ public:
if(currHeight>1)
currHeight>>=1;
}
this->widthLog=(uchar)(std::log(mipmaps[0].cols)/CV_LOG2+0.0001f);// std::epsilon or something? or why 0.0001f here?
this->heightLog=(uchar)(std::log(mipmaps[0].rows)/CV_LOG2+0.0001f);// Changed std::logf to std::log because it doesnt compile in linux (gcc 4.8). CHECK THAT
};
std::vector<cv::Mat>mipmaps;// make Texture a friend class of renderer, then move this to private?
unsignedcharwidthLog,heightLog;// log2 of width and height of the base mip-level
texture.mipmaps=mipmaps;
texture.widthLog=(uchar)(std::log(mipmaps[0].cols)/CV_LOG2+0.0001f);// std::epsilon or something? or why 0.0001f here?
texture.heightLog=(uchar)(std::log(mipmaps[0].rows)/CV_LOG2+0.0001f);// Changed std::logf to std::log because it doesnt compile in linux (gcc 4.8). CHECK THAT