   texture arrays
  hey! here's the problem: i want to load 6 images using devil end put them in a texture array. i guess i could do it one by one, basically repeating the same code 6 times (one for each image), but im trying to do it in a way that uses less lines of code. so here's what i have: void load_img_devil () {int width, height, format, il_img;ilInit ();iluInit();ilutRenderer(ILUT_OPENGL);for(int i=0;i<6;i++){ilGenImages (1, (ILuint*)&il_img); // get an unique IDilBindImage(il_img); // Bind this image name.if (i==0) if(!ilLoadImage((const wchar_t *)"F:\\Side1.png")) exit(0); // Load the imageif (i==1) if(!ilLoadImage((const wchar_t *)"F:\\Side2.png")) exit(0); // Load the imageif (i==2) if(!ilLoadImage((const wchar_t *)"F:\\Side3.png")) exit(0); // Load the imageif (i==3) if(!ilLoadImage((const wchar_t *)"F:\\Side4.png")) exit(0); // Load the imageif (i==4) if(!ilLoadImage((const wchar_t *)"F:\\Side5.png")) exit(0); // Load the imageif (i==5) if(!ilLoadImage((const wchar_t *)"F:\\Side6.png")) exit(0); // Load the imagewidth = ilGetInteger (IL_IMAGE_WIDTH);height = ilGetInteger (IL_IMAGE_HEIGHT);il_imgData = ilGetData();format = ilGetInteger(IL_IMAGE_FORMAT);// create GL textureglGenTextures (1, (GLuint *)&texID); // get texture unique IDglBindTexture (GL_TEXTURE_2D, texID); // bind it// associate with data read with DevILglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, format,GL_UNSIGNED_BYTE, il_imgData);// Release data space created with DevILilDeleteImages(1, (const ILuint *)&il_img);   }// Parameterise TextureglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);}the thing is.. it doesnt work. to test it i made a square and textured it with texID[0], it appears white; as with any other index.Note 1: texID and il_imgData are global variables; arrays with lenght 6.Note 2: if i open brackets after 'if(i==0)' and close it after the ilDeleteImages call, it works.(for the first image)   
  I'm pretty sure you cannot cast like that:(const wchar_t *)"F:\\Side1.png";  Use L"something here" to create a string literal using wchars.   ;  @DevFred: i can. i dont get any compiler errors or warnings. in fact, that's why i did the cast in the first place, otherwise i'd get a compiler error. plus, if i try to load only one texture, it works. my guess is the problem is somewhere in the loop.@Zahlman: i'm not sure what you mean but i think it's more or less what DevFred said, so...Thanks for the replies.   ;  That for loop seems like an excellent candidate for a function. Then you can just call it six times, once for each file.   ;Quote:Original post by Rui@DevFred: i can. i dont get any compiler errors or warnings. in fact, that's why i did the cast in the first place, otherwise i'd get a compiler error. plus, if i try to load only one texture, it works. my guess is the problem is somewhere in the loop.@Zahlman: i'm not sure what you mean but i think it's more or less what DevFred said, so...Thanks for the replies.No, DevFred is right. you're casting one type of pointer (char*) to (wchar_t* ).. One is an 8-bit ascii string, the other is a 16-bit unicode string, something which is valid C++ (so no compiler error) but in this case it's still a bug.Use L"F:\\Side1.png" to create a 16-bit unicode string.   ;Quote:Original post by Rui@DevFred: i can. i dont get any compiler errors or warnings. in fact, that's why i did the cast in the first place, otherwise i'd get a compiler error. plus, if i try to load only one texture, it works. my guess is the problem is somewhere in the loop.@Zahlman: i'm not sure what you mean but i think it's more or less what DevFred said, so...Thanks for the replies.While casting like that isn't a compiler error, it's a logical error and most likely explains why you're getting untextured triangles.To use wide character strings use a capital L before the quotation mark.;Quote:Original post by dashurcWhile casting like that isn't a compiler error, it's a logical error and most likely explains why you're getting untextured triangles.Hey, i resent that! ;)   ;Quote:Original post by Rui@DevFred: i can. i dont get any compiler errors or warnings. in fact, that's why i did the cast in the first place, otherwise i'd get a compiler error.So if you give meat to a vegetarian and he complains "I don't like meat", what do you do? Simply tell him "Don't worry, just pretend it's a vegetable"?   ;  k, thanks everyone. i see now why that's an error. devfred really put it in perspective for me lol.. but replacing '(const wchar_t*) "F:\\Side1.pgn"' for 'L"Side1.pgn"' made ilLoadImage exit though..(following erissian's advice it works perfect, with 'const wchar_t*')any ideas why that might be?   