title: SDL2 texture's pixel format and surface color mask
body: <p>I'm trying to create a SDL_Surface for pixel manipulation, however something is going really wrong when setting the color masks of the surface as the colors are incorrect when filling the color buffer (see the comments, I'm trying to interpret u8vec4 as a RGBA color):</p>
  
  <pre><code>const int win_width = 640;
  const int win_height = 480;
  std::vector&lt;glm::u8vec4&gt; colors{ win_width * win_height, glm::u8vec4{ 0, 0, 0, 0 } };
  
  SDL_Surface* render_surface = SDL_CreateRGBSurfaceFrom(&amp;colors[0], win_width, win_height, 32,
      sizeof(glm::u8vec4) * win_width, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
  
  SDL_Texture* render_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, 
      SDL_TEXTUREACCESS_STREAMING, win_width, win_height);
  
  // { 255, 0, 0, 255 } = Red
  // { 255, 0, 0, 100 } = Darker red, alpha seems to be working
  // { 0, 255, 0, 255 } = Purple!? Should be green?
  // { 0, 0, 255, 255 } = Yellow, expecting blue
  std::fill(colors.begin(), colors.end(), glm::u8vec4{ 0, 0, 0, 255 }); // Red
  SDL_UpdateTexture(render_texture, nullptr, render_surface-&gt;pixels, render_surface-&gt;pitch);
  SDL_RenderClear(renderer);
  SDL_RenderCopy(renderer, render_texture, nullptr, nullptr);
  SDL_RenderPresent(renderer);
  </code></pre>