last week, I had the problem, that I could not load jpeg-Files with devil (and with no other library). This problem is solved, but today I run into a new problem.
I have 2 jpg-files tex1.jpg and tex2.jpg
When I want to load tex1.jpg, everything is fine. But when ! want to load the second texture, I get an assertion fault. I checked the textures, both are ok, in the right folder and I could open them with GIMP without any problems.
I also tried to load a different texture (tex3.jpg) which is twice as large as tex2.jpg and everything was fine. So my problem is: I dont know why, but I can load several jpg-files, without any problems. But when I try to load tex2.jpg, everything crashes. Are there differences between jpg-files? Even when they are created by the same program (i.e. GIMP)?
I tried different libraries as DevIL, SOIL, etc.
Everytime I get the same error.
Does anybody know what that might be?
Thanks a lot
Here is a piece of code:
bool loadTexture(GLuint* tex_id, const char* filename){
// load image file as opengl texture
cout << "Texture " << filename;
*tex_id = SOIL_load_OGL_texture(filename, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
if(*tex_id == 0){
cout << " could not be loaded!" << endl;
return false;
}
else{
cout << "...ok" << endl;
}
....
return true;
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
// init display mode:
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
center();
glutInitWindowSize (mainw_w, mainw_h);
glutInitWindowPosition (mainw_x, mainw_y);
glutCreateWindow(mainw_title);
// init OpenGL
initGL();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}