2D display looks weird in OpenGL
Currently I am writing a video player in OpenGL.
I call gluOrtho2D like this:
gluOrtho2D(0, w, 0, h);
And output it with:
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex2f(0, this->height());
glTexCoord2f(1.0f, 0.0f); glVertex2f(this->width(), this->height());
glTexCoord2f(1.0f, 1.1f); glVertex2f(this->width(), 0);
glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, 0.0f);
glEnd();
The correct output should be like:
But 开发者_开发技巧what I see is... (Please pay attention to the bottom right corner)
It seems that it's rendered incorrectly. Maybe you would recommend me to use sdl_opengl... But I'm currently using OpenGL in Qt, so I would not be able to open SDL windows.
So, what should I do?
Is it perhaps because you're using 1.1f
as the y
part of the 3rd texture coordinate?
精彩评论