Write by nine days Yan Ling (jtianling) -- blog.csdn.net/vagrxie
Discuss newsgroups and documents
Same paragraphProgramIn SDL with OpenGL, it is correct when glfw is used and Windows API is used to add OpenGL.
As follows:
Glbegin (gl_quads );
Gltexcoord2f (0.0, 0.0); glvertex3f (-1.0,-1.0, 0.0 );
Gltexcoord2f (1.0, 0.0); glvertex3f (1.0,-1.0, 0.0 );
Gltexcoord2f (1.0, 1.0); glvertex3f (1.0, 1.0, 0.0 );
Gltexcoord2f (0.0, 1.0); glvertex3f (-1.0, 1.0, 0.0 );
Glend ();
By default, the origin of the UV coordinate of the texture is in the lower left corner, which is in the upper left corner by default in SDL. Therefore, you need to reverse the coordinate Y axis of the texture above, this shows that there is no problem. As shown below:
Glbegin (gl_quads );
Gltexcoord2f (0.0, 1.0); glvertex3f (-1.0,-1.0, 0.0 );
Gltexcoord2f (1.0, 1.0); glvertex3f (1.0,-1.0, 0.0 );
Gltexcoord2f (1.0, 0.0); glvertex3f (1.0, 1.0, 0.0 );
Gltexcoord2f (0.0, 0.0); glvertex3f (-1.0, 1.0, 0.0 );
Glend ();
OriginalArticleThe author retains the copyright reprinted. Please indicate the original author and give a link
Write by nine days Yan Ling (jtianling) -- blog.csdn.net/vagrxie