问题
Anyone happen to know why I'm getting a segmentation fault at line 2 below (this is after all my glInit stuff)? I've tried different image formats (.jpeg, .png, .bmp, all from internet). Debug tips or anything helps! If you wanna see more source, ask and I'll edit promptly.
ilutRenderer(ILUT_OPENGL);
GLuint tex1 = ilutGLLoadImage("/home/brent/Desktop/myimage.jpeg");
gdb backtrace, for what it's worth:
#0 0x00000000 in ?? ()
#1 0x021b318e in ilDetermineType (
FileName=0x804ad84 "/home/brent/Desktop/myimage.jpeg")
at ./../src-IL/src/il_io.c:178
#2 0x021b3290 in ilLoadImage (
FileName=0x804ad84 "/home/brent/Desktop/myimage.jpeg")
at ./../src-IL/src/il_io.c:2124
#3 0x003bafc2 in ilutGLLoadImage () from /usr/lib/libILUT.so.1
#4 0x08049f43 in init () at facecube.cpp:112
#5 0x0804a539 in main (argc=1, argv=0xbffff3d4) at facecube.cpp:295
Closer look at entry #1:
#1 0x021b318e in ilDetermineType (
FileName=0x804ad84 "/home/brent/Desktop/myimage.jpeg")
at ./../src-IL/src/il_io.c:178
178 File = iopenr(FileName);
回答1:
Solution:
ilInit();
iluInit();
ilutRenderer(ILUT_OPENGL);
GLuint tex1 = ilutGLLoadImage("/home/brent/Desktop/myimage.jpeg");
来源:https://stackoverflow.com/questions/8351115/segmentation-fault-at-ilutglloadimage