Loading texture for OpenGL with OpenCV

后端 未结 4 1784
南方客
南方客 2020-12-25 10:15

I have seen many code samples for loading textures for OpenGL, many of them a bit complicated to understand or requiring new functions with a lot of code. <

4条回答
  •  醉梦人生
    2020-12-25 10:56

    The assignment operator

    texture_cv = imread("stones.jpg")
    

    returns a cv::Mat that can't be used in a conditional expression. You should write something like

    if((texture_cv = imread("stones.jpg")) != /* insert condition here */ )  {
          //...
    }
    

    or

    texture = imread("stone.jpg");
    if(!texture.empty())  {
              //...
    }
    

提交回复
热议问题