- glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch);
- check_error();
- // Intel/Mesa seems to have a broken glGenerateMipmap() for non-FBO textures, so do it here
- // instead of calling glGenerateMipmap().
- glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, needs_mipmaps ? GL_TRUE : GL_FALSE);
- check_error();
- glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, NULL);
- check_error();
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);