开发者

2D display looks weird in OpenGL

开发者 https://www.devze.com 2023-04-13 04:11 出处:网络
Currently I am writing a video player in OpenGL. I call gluOrtho2D like this: gluOrtho2D(0, w, 0, h); And output it with:

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:

2D display looks weird in OpenGL

But 开发者_开发技巧what I see is... (Please pay attention to the bottom right corner)

2D display looks weird in OpenGL

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号