rare texture mapping problem

Started by
5 comments, last by MARS_999 17 years, 2 months ago
Hi, i have mi method for loading a bmp, and this is the code:

void CImageLoader::LoadBMP( char* strImageName, UINT textureArray[], int textureID )
{
	BITMAP* pImageBuffer1;
	pImageBuffer1 = load_bmp( strImageName, NULL);
        glGenTextures(1, &textureArray[textureID]);
        glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
        
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImageBuffer1->w, pImageBuffer1->h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1->dat);   // here is the problem

         destroy_bitmap( pImageBuffer1 );	
}
I did that code in my other computer, and it worked perfectly (amd64), and now, i have to program in my laptop (dell xps, intel core 2 duo), but it doesnt works in my lap!! the problem is when i use the gluBuild2Mipmaps..... this is the error the debugger throws: First-chance exception at 0x68b27372 in avance1.exe: 0xC0000005: Access violation reading location 0x02ab3000. Unhandled exception at 0x68b27372 in avance1.exe: 0xC0000005: Access violation reading location 0x02ab3000. how is it possible that in both computers compile, but in one runs, and in the other doesnt...... thanks for any possible help
Advertisement
I'd say its not an OpenGL problem but rather a problem of reading pImageBuffer1.
Try to read the pointers you pass to gluBuild2DMipmaps yourself to see whether this works or not.

The problem here could be that you are using different versions of system DLLs like the CRT DLLs (assuming you're using windows).
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Hi, what are the "CRT DLLs"

so, should if thats the problem, should i copy the dlls from my other computer, to this new computer? i think the problem is with the glu/glut library...

CRT DLLs are the common runtine libraries that windows programs use. They might be the problem but thats not for sure.

Did you try to access the fields you pass to gluBuildMipmap by yourself (especially those at the bounds of the array, i.e. the last ones)? Does it crash then? If so, glut itself is not the problem.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Quote:Original post by Lord_Evil


Did you try to access the fields you pass to gluBuildMipmap by yourself (especially those at the bounds of the array, i.e. the last ones)? Does it crash then? If so, glut itself is not the problem.


yes i did it, and it doesnt crash, and yes, i'm on windows xp.
If i comment the
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImageBuffer1->w, pImageBuffer1->h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1->dat);
the program doesnt crash, but obviously it doesnt map the texture to the primitve....

so.... what can i do? :s
nobody?
Try this


gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, pImageBuffer1->w, pImageBuffer1->h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1->dat);

and make sure your data is arranged as RGBA and not BGRA

This topic is closed to new replies.

Advertisement