texture mapping problem

Hi

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?

cheers

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.

kon

Do you mean that the texture may not there? -

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?

kon

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).]

maybe TextureImage[texnum] == NULL or texnum out of bounds? what about a debug session?