I try to draw the texture in OpenGL, but when rendering it, the image for some reason rotates 180 degrees and is mirrored horizontally. I can not understand the reason, the image itself has the correct orientation. Below is the image load code in OpenGL:

_textureId = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, _textureId); BitmapData bmpData = _texture.LockBits( new Rectangle(0, 0, _texture.Width, _texture.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, _texture.Width, _texture.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); GL.BindTexture(TextureTarget.Texture2D, 0); _texture.UnlockBits(bmpData); 
  • This is usually due to the orientation in which the image is stored in the file and applied to UV coordinates. Also in different systems, the UV direction is assumed to be different. - Kromster

0