View Full Version : texture mapping problem

11-23-2001, 05:46 AM

I've implemented texture mapping from nehe's tutorial and the program compiles but crashes with unhandled exception glu32

I can't really see the problem

any ideas?


11-23-2001, 05:52 AM
Which glu functions are you calling? Just guessing gluBuildMipMaps... and perhaps the image data you load from a file (Bitmap) and pass to gluBuildMipMaps is empty.


11-23-2001, 06:02 AM
Do you mean that the texture may not there? -

11-23-2001, 06:44 AM
Just guessing. Check the path and file name of the bitmap(s) you want to load. Set a breakpoint at the place you call gluBuildMipMap() and check the data pointer if it is valid.
Is gluBuildMipMap the only glu-function you are calling from the glu-library?


11-25-2001, 11:32 PM
No I use glTexImage2D. It's as follow:

I have LoadBMP(char* Filename) and LoadGLTextures() from nehe's tutorial in DrawGLObjects class - where I draw all the object of my scene - I call the functions of the object in MyprojView class in OnPaint(). In initOpenGL() (in myprojView class) I have:
if (!LoadGLTextures())
return FALSE;

The program compiles fine but crashes with unhandled exception pointing to this line in LoadGLTextures():

glTexImage2D(GL_TEXTURE_2D, 0, 1, TextureImage[texnum]->sizeX, TextureImage[texnum]->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[texnum]->data);

and stating error - can not access data
can not acess sizeX
can not access sizeY

[This message has been edited by fox (edited 11-26-2001).]

11-26-2001, 03:29 AM
maybe TextureImage[texnum] == NULL or texnum out of bounds? what about a debug session?