When trying to load BMP pictures to use them as textures, i stumbled upon an apparently recurrent compatibility issue between sdl and opengl namely that sdl uses a Blue-Green-Red[-Alpha] encoding in the pixels fields of surface records, while raw objects for openGL are expected in a Red-Green-Blue[-Alpha] format. See for instance

The same happens when writing with a true type font on a surface and sending it to openGL afterwards. I had a look at the sdl stub in glcaml and indeed the problem is taken care of in the C function responsible for loading BMP for texture loading. I just adapted the code to ocamlsdl, by creating a function

val Sdlgl.glconvert : Sdlvideo.surface -> unit

which (reversibly) converts a BGR formatted surface to RGB. Here the adapted code from glcaml

CAMLprim value ml_SDL_GL_glconvert(value s)
  Uint8 *rowhi, *rowlo;
  Uint8 *tmpbuf, tmpch;
  int i, j;
  SDL_Surface *surf;
  surf = SDL_SURFACE(s);
  tmpbuf = (Uint8 *)malloc(surf->pitch);
  rowhi = (Uint8 *)surf->pixels;
  rowlo = rowhi + (surf->h * surf->pitch) - surf->pitch;
  for ( i=0; i<surf->h/2; ++i ) {
    for ( j=0; j<surf->w; ++j ) {
      tmpch = rowhi[j*3];
      rowhi[j*3] = rowhi[j*3+2];
      rowhi[j*3+2] = tmpch;
      tmpch = rowlo[j*3];
      rowlo[j*3] = rowlo[j*3+2];
      rowlo[j*3+2] = tmpch;
    memcpy(tmpbuf, rowhi, surf->pitch);
    memcpy(rowhi, rowlo, surf->pitch);
    memcpy(rowlo, tmpbuf, surf->pitch);
    rowhi += surf->pitch;
    rowlo -= surf->pitch;

It's not well tested, but before I propose a real patch, I would like to ask you whether you know the problem and maybe a better workaround. I have very little experience with sdl and opengl.