Jump to content
  • Advertisement
Sign in to follow this  
BlackWind

rare texture mapping problem

This topic is 4321 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!