Greyscale image in SDL2
问题 I have an array of uint8_t which represents a greyscale picture, where each pixel is one uint8_t . I would like to display this in a window using the SDL2 library. I have tried to create an SDL_Surface from the array by doing mSurface = SDL_CreateRGBSurfaceFrom(mData, mWidth, mHeight, 8, mWidth, 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000); However, the problem is that when a depth of 8 bits is passed to SDL_CreateRGBSurfaceFrom (as I have done here), according to the SDL2 wiki "If depth is 4 or 8