Ok, I'm going to post this bug, though I doubt its fixibale, as it seems to break the very laws of electronic components. heres the problem, if i do this (numMaterials is 1)
void MSmodel::loadTextures(){
int i;
ILuint texturePtr;
for(i=0; i<numMaterials; i++){
allegro_message("4.1.2: %d", numMaterials);
if(strlen(material.textureFilename) > 0){
ilGenImages(1, &texturePtr);
ilBindImage(texturePtr);
if(!ilLoadImage(material.textureFilename)){
ilBindImage(0);
}
iluNegative();
material.texture = ilutGLBindTexImage();
ilDeleteImages(1, &texturePtr);
}else{
material.texture = 0;
}
}
}
i will get a message box saying "4.1.2: 1", as i should, and then one saying "4.1.2: 684", which means that numMaterials was being changed somewhere in that loop the first time it went though. Now I could accept that as a memory bug in one of the above function, but it gets much stranger. if i do this to try and find which function has the memory error that is changing the value of numMaterials
void MSmodel::loadTextures(){
int i;
ILuint texturePtr;
for(i=0; i<numMaterials; i++){
allegro_message("4.1.2: %d", numMaterials);
if(strlen(material.textureFilename) > 0){
allegro_message("4.1.3: %d", numMaterials);
ilGenImages(1, &texturePtr);
allegro_message("4.1.4: %d", numMaterials);
ilBindImage(texturePtr);
allegro_message("4.1.5: %d", numMaterials);
if(!ilLoadImage(material.textureFilename)){
ilBindImage(0);
}
allegro_message("4.1.6: %d", numMaterials);
iluNegative();
allegro_message("4.1.7: %d", numMaterials);
material.texture = ilutGLBindTexImage();
allegro_message("4.1.8: %d", numMaterials);
ilDeleteImages(1, &texturePtr);
allegro_message("4.1.9: %d", numMaterials);
}else{
material.texture = 0;
}
allegro_message("4.1.10: %d", numMaterials);
}
allegro_message("4.1.11: %d", numMaterials);
}
all the messages will say numMaterials is 1, and it does not change to 684. and in the second case, after the final message, when the function should return to wherever it had been called, it crashes. This bug has me completly lost. If anyone can help me on this, I will be greatly appreciative.
[Edited by - relpats_eht on July 18, 2005 3:17:14 PM]