This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cv::Mat img = cv::imread("img.png"); | |
GLuint tex_in; | |
glGenTextures(1, &tex_in); | |
glBindTexture(GL_TEXTURE_2D, tex_in); | |
/*By practice, the internalParam: | |
* GL_RGB, GL_RGBA, GL_RGB8, GL_RGBA8 work | |
* GL_RGB8UI, GL_RGBA8UI don't work | |
*/ | |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, img.cols, img.rows, 0, GL_BGR, GL_UNSIGNED_BYTE, img.data); // copy data to texture object |