SUB CreateBMPTexture filename$ , texture
call glBindTexture GL.TEXTURE.2D , texture
OPEN "DevIL.dll" FOR dll AS #dev
CALLDLL #dev , "ilInit" , ret AS long
'CALLDLL #dev , "ilGenImages" , 1 AS long , ret AS long
CALLDLL #dev , "ilBindImage" , 1 AS long , ret AS long
CALLDLL #dev , "ilLoadImage" , filename$ AS ptr , ret AS long
CALLDLL #dev , "ilConvertImage" , 6408 AS long , 5121 AS long , ret AS long
CALLDLL #dev , "ilGetData" , array AS long
'STRUCT arr , bitmaparray AS long
'arr.bitmaparray.struct = array
CALLDLL #dev , "ilGetInteger" , 3560 AS long , IL.IMAGE.BPP AS long
CALLDLL #dev , "ilGetInteger" , 3556 AS long , IL.IMAGE.WIDTH AS long
CALLDLL #dev , "ilGetInteger" , 3557 AS long , IL.IMAGE.HEIGHT AS long
CALLDLL #dev , "ilGetInteger" , 3562 AS long , IL.IMAGE.FORMAT AS long
'CALLDLL #gl , "glTexImage2D" , 3553 AS long , 0 AS long , IL.IMAGE.BPP AS long , IL.IMAGE.WIDTH AS long , IL.IMAGE.HEIGHT AS long , IL.IMAGE.FORMAT AS long , 5121 AS long , array AS long , ret AS long
CALLDLL #glu , "gluBuild2DMipmaps" , 3553 AS long , 4 AS long , IL.IMAGE.WIDTH AS long , IL.IMAGE.HEIGHT AS long , 6408 AS long , 5121 AS long , array AS long , ret AS long
CALLDLL #dev , "ilDeleteImages" , 1 AS long , ret AS long
CLOSE #dev
END SUB