OpenGL pixels drawn with each horizontal pair replaced

I'm a little new to OpenGL, although I'm sure my problem is using the used pixel format or how my texture is created ...

I paint the texture on a flat 2D quad using the 16-bit RGB5_A1 format, although at this stage I am not using alpha. The problem I am facing is that each pair of horizontal pixel values ​​has been replaced.

That is ... if the pixel positions should be in that order (suppose an 8x2 image)

0 1 2 3 
4 5 6 7

instead they are drawn as

1 0 3 2
5 4 7 6

Or, more clearly from this image (below). On the left is what I get ... Right is what I have to get.

.

, ... ? - ? , , , , . .

. , . , , 32- ( 24-).

+3
1

, , OpenGL-. ? 1 ( 4).

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

-1

Source: https://habr.com/ru/post/1784899/


All Articles