I was able to reproduce this locally too.  Would you mind opening a bug on
the emscripten tracker?

On Fri, Nov 4, 2022 at 12:55 PM Piotr Grochowski <
anydesksuckmehw...@gmail.com> wrote:

> SDL2 library in emscripten swaps red and blue channels which makes it
> false color.
>
> //C:\dm\bin\dmc colortest.cpp -o -I C:\dm\stlport\stlport -I
> C:\Users\Admin\Downloads\SDL2-devel-2.0.22-VC\SDL2-2.0.22\include
> C:\Users\Admin\Downloads\SDL2-devel-2.0.22-VC\SDL2-2.0.22\lib\x86\sdl.lib
> -L/exet:nt/su:windows:4.0
> //emcc colortest.cpp -O3 -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -o
> colortest.html
> #define SDL_MAIN_HANDLED
> #include <SDL.h>
> int main(int argc, char *argv[]){
>     const int width=128; const int height=64;
>     SDL_Window* window = SDL_CreateWindow("color test",
> SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0);
>     SDL_Surface* screenSurface = SDL_GetWindowSurface(window);
>     unsigned* bitmapdata = (unsigned*)screenSurface->pixels;
>     for(int
> i=0;i<width*height;i++)bitmapdata[i]=(i>>5&1?0xFF0000:0)|(i>>6&1?0x00FF00:0)|(i>>12&1?0x0000FF:0);
>     while (1){
>     SDL_Event event_;
>     while (SDL_PollEvent(&event_)) if(event_.type==SDL_QUIT)exit(0);
>     SDL_UpdateWindowSurface(window); SDL_Delay(1);
>     }
>     return 0;
> }
>
> https://i.imgur.com/EMQhoF5.png
>
> How do I ensure the video image is always drawn correctly when
> represented in 0x00RRGGBB (note: little endian byte order is BGR)?
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/b6b2f368-7ef3-4ec6-89a4-3ef7862108b8n%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/b6b2f368-7ef3-4ec6-89a4-3ef7862108b8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va291FNj1Tb4G9fojV-G7r97CBsPh_p_ZBa2%2BXFQsQNzihQ%40mail.gmail.com.

Reply via email to