Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi.

You need to do a little more work than this.

int loadTexture_Ipl(IplImage *image, GLuint *text) {

if (image==NULL) return -1;

glGenTextures(1, text);

glBindTexture( GL_TEXTURE_2D, *text ); //bind the texture to it's array

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->width, image->height,0, GL_BGR, GL_UNSIGNED_BYTE, image->imageData);

return 0;

}

Clearly you are using a cv::Mat but i think you can use cv::Mat.data in place of image->imageData.

Hi.

You need to do a little more work than this.

int loadTexture_Ipl(IplImage *image, GLuint *text) {

if (image==NULL) return -1;

glGenTextures(1, text);

glBindTexture( GL_TEXTURE_2D, *text ); //bind the texture to it's array

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->width, image->height,0, GL_BGR, GL_UNSIGNED_BYTE, image->imageData);

return 0;

}

The above is pretty old school. Are there no examples?

Clearly you are using a cv::Mat but i think you can use cv::Mat.data in place of image->imageData.when defining the texture.