I know I just asked eariler about bmps and said that I din't want to use SDL, well png's were annoying me because of the lack of documentation on the function I needed so I started sdl. I want to load a heightmap, the picture I want to use is a tga. I said screw that and converted it to bmp. I loaded the code from NeHe using the SDL_LoadBMP function(it works on their picture), but it seg faults on my picture. I even wrote my own bmp and cut the image from the tga and then pasted it on my bmp. gimp said its thing and did the conversion. No avail. Here is the code that doesn't work on my image, but on Nehe's it doesI feel like a beginner, where hello world doesn't work. If anything does anyone here have a heightmap that is a bmp?Code:int tl(void){ int status=0; SDL_Surface *TextureImage[1]; if((TextureImage[0]=SDL_LoadBMP("/home/michael/temp/lesson-6/lesson06/da ta/nehe.bmp"))){/*their picture*/ status=1; glGenTextures(1,&texture[0]); glBindTexture(GL_TEXTURE_2D,texture[0]); glTexImage2D(GL_TEXTURE_2D,0,3,TextureImage[0]->w,TextureImage[0 ]->h,0,GL_BGR,GL_UNSIGNED_BYTE,TextureImage[0]->pixels); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } if(TextureImage[0]) SDL_FreeSurface(TextureImage[0]); return status; }
[edit]If i edit out the glTexImage2D function it doesn't seg, but of course no texture. What would cause it?