This topic is 2461 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys,

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; } 

##### Share on other sites
There are several options you can choose when exporting to GIMP. I encourage you to try to reexport using various options, or even change the format to other than JPEG and see if it works. No idea what it could be, but it has nothing to do with the code, but your image, which you don't provide.

##### Share on other sites
Maybe some trouble with an missing alpha channel ? Where exactly does it crash (=>debugger) ? Try this in gimp: save the file as tga, reload it, save it as jpg . What happens when using some other other format (png) ?

##### Share on other sites
Hidden
Hey,

the problem is, that I have to use these images. I am working on a project for my computer graphics course and the images are given from the professor. i uploaded the tex2.jpg to http://s14.directupl...8q8p6v5_jpg.htm. The curious thing is, that nobody else has such problems with the images - thus I thought it might be a problem with my pc oder something like this.

Edit:
The crash is caused by
 else { /* user want OpenGL to do all the work! */ glTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, original_texture_format, GL_UNSIGNED_BYTE, img ); check_for_GL_errors( "glTexImage2D" ); /*printf( "OpenGL DXT compressor\n" ); */ } 

within the SOIL-library.

Are you using the binary version of DevIL? You could try to compile the source code, link it to your project and debug it, so you can see what is happening. Or, simpler, you could just get the error code out of DevIL and see what does it mean. DevIL will store error codes for you, so immediately after your code encounters an issue, try finding out what error code you get.

##### Share on other sites
Hey,

the problem is, that I have to use these images. I am working on a project for my computer graphics course and the images are given from the professor. i uploaded the tex2.jpg to http://s14.directupl...8q8p6v5_jpg.htm. The curious thing is, that nobody else has such problems with the images - thus I thought it might be a problem with my pc oder something like this.

Edit:
The crash is caused by
 else { /* user want OpenGL to do all the work! */ glTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, original_texture_format, GL_UNSIGNED_BYTE, img ); check_for_GL_errors( "glTexImage2D" ); /*printf( "OpenGL DXT compressor\n" ); */ } 

within the SOIL-library.

Maybe some trouble with an missing alpha channel ? Where exactly does it crash (=>debugger) ? Try this in gimp: save the file as tga, reload it, save it as jpg . What happens when using some other other format (png) ?

Done. I get the same error.

##### Share on other sites

Are you using the binary version of DevIL? You could try to compile the source code, link it to your project and debug it, so you can see what is happening. Or, simpler, you could just get the error code out of DevIL and see what does it mean. DevIL will store error codes for you, so immediately after your code encounters an issue, try finding out what error code you get.

At the moment, I use the SOIL-Library. I tried it also with DevIL but then I had the problem, that all of the textures are completely black.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013736
×