PDA

View Full Version : texture mapping problem



fox
11-23-2001, 06:46 AM
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

kon
11-23-2001, 06: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.

kon

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

kon
11-23-2001, 07: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?

kon

fox
11-26-2001, 12:32 AM
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).]

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