Image displays in proper dimensions.
This commit is contained in:
parent
baef478bba
commit
f982e4721d
10
main.cpp
10
main.cpp
|
@ -34,7 +34,7 @@ void loadTexture (GLuint& imageTexture1)
|
||||||
cout << "image empty" << endl;
|
cout << "image empty" << endl;
|
||||||
} else {
|
} else {
|
||||||
cout << "loaded " << image_path << endl;
|
cout << "loaded " << image_path << endl;
|
||||||
//flip(image, image, 1);
|
flip(image, image, 0);
|
||||||
#if (CV_VERSION_MAJOR >= 4)
|
#if (CV_VERSION_MAJOR >= 4)
|
||||||
cvtColor(image, image, cv::COLOR_BGR2RGB);
|
cvtColor(image, image, cv::COLOR_BGR2RGB);
|
||||||
#else
|
#else
|
||||||
|
@ -89,10 +89,10 @@ void display(void)
|
||||||
glBindTexture(GL_TEXTURE_2D, imageTexture);
|
glBindTexture(GL_TEXTURE_2D, imageTexture);
|
||||||
|
|
||||||
glBegin(GL_QUADS); // front face
|
glBegin(GL_QUADS); // front face
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); //bottom right
|
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 0.0f); //bottom right
|
||||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); //top right
|
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f); //top right
|
||||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f); //top left
|
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f); //top left
|
||||||
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 0.0f); //bottom left
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); //bottom left
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
|
|
Loading…
Reference in New Issue