SOIL_load_image
will return unsigned char*
yes, array holding your image data.
Then you will normally feed this data to gl
using glGenerateTextures
, assign texture IDs, calling glTexImage2D
.
SOIL_load_OGL_texture
returns a texture id, so you could do this instead:
texture[0] = SOIL_load_OGL_texture(...)
if your goal is to load textures 0,1,2.
As for invert y, the easiest and weight free solution is to flip the texture coordinates in glTexCoord
, but it depends on what you are doing. If you are loading resources as a one time only operation or like, it can’t hurt, except some startup time probably not worth mentioning. But if you’re loading resources dynamically through the main loop when needed, then invert y flag (and about any flag), can hurt performance because of additional processing throughout your entire program.
One big advantage to using SOIL_load_image
is that you can retrieve width, height and channel number from the original image which SOIL_load_OGL_texture
doesn’t provide.
If it helps, SOIL_load_OGL_texture
would crash after a while when loading RGB images as RGB but worked fine all the way with SOIL_LOAD_RGBA
, that could be a fix to your problem.
I still find it easier with SOIL_load_image
. I hope any of this helps. Also check the SOIL source code that ships with soil to see what’s going on.