Judging by your example Tux code, you can skip SDL completely and manually load OpenGL data with the following code:
GLuint tex; glGenTextures (1, &tex); glBindTexture (GL_TEXTURE_2D, tex); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, image);
The important details here are the GL_BGRA
format for pixel data and the GL_UNSIGNED_INT_8_8_8_8_REV
data type (this overrides the channel order during pixel transfer operations). OpenGL will take care of converting the pixel data into the appropriate texel format for you. OpenGL ES, on the other hand, will not do this; to make this transfer, you may want to convert the pixel data to RGBA or BGRA yourself ...
source share