Hi, I'm running Mandriva Linux 2006 with an nVidia GeForce4 420 Go card.
I am experiencing some problems trying to get OpenGL textures to work. The problem is that when I try to generate the texture, be it via glTexImage2D or gluBuild2DMipmaps, my application crashes. I've deduced that it is a problem with the images I'm loading, even though they are perfectly fine (a 256x256 bitmap will fail). I enable textures in my custom init() function, and everything seems ok to me. The strange thing is that this code worked perfectly before I upgraded my system (from 10.1 to 2006), even though I doubt that the upgrade had anything to do with it.
As of now, I tried out a variety of different image programs, but any image I create will not work. I changed the permissions of the images and everything, but something just won't budge.
I'm not sure what I'm doing wrong, so if anyone has any ideas, I'd be glad to learn. :)
Thanks in advance!
Here is the loading code in question:
void loadGLTextures() {
SDL_Surface *tex=SDL_LoadBMP("particle.bmp");
if (!tex) {
printf("Unable to load texture 'particle.bmp'\n");
exit(0);
}
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, tex->w, tex->h, GL_RGB, GL_UNSIGNED_BYTE, tex->pixels);
if (tex)
SDL_FreeSurface(tex);
};
And here is my init code:
void initGL() {
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, screen->w/screen->h, 0.1, 100.0);
glMatrixMode(GL_MODELVIEW);
// load textures
loadGLTextures();
};
[Edited by - acrimon on January 25, 2006 7:50:18 PM]