View Full Version : TGA and seg fault....

01-07-2003, 09:51 AM
I'm getting strange output - i load TGA,
glGenTextures (1, &TextureArray[TextureID]);
glBindTexture (GL_TEXTURE_2D, TextureArray[TextureID]);

fprintf(stderr, "trying to bind texture\n");
gluBuild2DMipmaps (GL_TEXTURE_2D, Type, Width, Height, Type, GL_UNSIGNED_BYTE, Data);
fprintf(stderr, "texture bound\n");

and when prog gets to gluBuild2DMipmaps i receive
segmentation fault.
What can be wrong??????
I use GLFW if that matters

01-07-2003, 10:39 AM
Output the values of the parameters passed to gluBuildMipmaps and make sure they are valid.

01-07-2003, 10:50 AM
Actually above happens under Linux,
under windows with bc++builder i don't
have seg fault, but no texture at all.

01-07-2003, 11:17 AM
I solved it...
it was because i called for gluBuild2DMipmaps
before initializing any OGL stuff....
I almost got my hair pulled out 'cause of this...

01-07-2003, 11:17 AM
You probably are passing invalid parameters to gluBuild2DMipmaps. Invalid parameters are probably handled differently in different libraries, which is why you get different results in linux and windows, but neither results in a valid texture.