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
I notice you're not testing if load_bmp fails. You should probably also use load_bitmap instead of the format-specific load_bmp.
Anything wrong with GLuint allegro_gl_make_texture_ex (int flags, BITMAP *bmp, GLint internal_format);?
As gnolam said you should use allegro_gl_make_texture_ex. IIRC, .dat pointer contains more than just raw pixel data, it had line pointers in it too and that is probably what breaks things.
Hi,
Kitty Cat: i checked if the texture was loaded, and it was (i also try with load_bitmap), if i comment:
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImageBuffer1->w, pImageBuffer1->h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1->dat);
it doesnt send me and error, but obviously it doesnt maps the texture to the primitive..
Gnolam: how do i use the GLuint allegro_gl_make_texture_ex (int flags, BITMAP* bmp, GLint internal_format)
i read the docs, but i'm not sure what should i send in the "GLint internal_format" parameter. can you give me a little example how would it be the complete method?
HoHo: then why did it worked perfectly in my other computer? i only recompiled it in my lap with the same compiler (vs2005) the code is EXACTLY the same
then why did it worked perfectly in my other computer?
Probably because I was wrong
Note to self:
next time make sure you know what you are talking about. There is a separate lines[] pointer in BITMAP structure that does what I said
unless you want to make your own function, look for:
allegro_gl_make_texture
allegro_gl_make_masked_texture
well, i can do this....
BITMAP* bmp1 = load_bmp( "Bitmap.bmp" , NULL);
allegro_gl_make_texture(bmp1);
but then... what should i do so the texture mapps with the primitive?
and how do i use the GLuint allegro_gl_make_texture_ex (int flags, BITMAP* bmp, GLint internal_format)
look around for "textured quads", and spend some time studying opengl.
I think one of the examples of allegrogl draws a textured quad..