Image rendering issue


I am trying to render 411x411 image by opengl.

But whenever rendering the image it’s get distorted.

it is displaying diagonally.

Thanks & Regards,

Screenshot from 2020-12-16 06-42-16

Before calling glTexImage2D, you need to call

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

The default alignment is 4 bytes, which is fine for RGBA data, but not for RGB or BGR unless the width is a multiple of 4.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.