Bitmap display
Pretty simple problem, maybe this one is easier to understand than the last one I posted
All I am trying to do is display a 32x32 red bmp to my ddraw window. I have red.bmp in the project folder. I run my executable and kaboom, I get an access violation trying to read 0x00000000. Doing some debug stuff, it appears the first line pasted here is failing.... looking at code examples, I don''t see what I am doing wrong. Any ideas?
g_pDisplay->CreateSurfaceFromBitmap(&g_pBitmap, "red.bmp", 32, 32) <--- this is failing?
g_pDisplay->Clear(0);
g_pDisplay->Blt(0,0,g_pBitmap,0);
g_pDisplay->Present();
g_pBitmap->Destroy();
First make sure that g_pDisplay has been created successfully and that it points to something. Also make sure that g_pBitmap is valid and points to something.
Alaa,
Alaa,
Here are my three globals...
CDisplay *g_pDisplay = NULL;
CSurface *g_pBitmap = NULL;
CSurface *g_pText = NULL;
g_pText seems to work just fine, so I''m _assuming_ g_pBitmap is fine.
CDisplay *g_pDisplay = NULL;
CSurface *g_pBitmap = NULL;
CSurface *g_pText = NULL;
g_pText seems to work just fine, so I''m _assuming_ g_pBitmap is fine.
Well, now I am *really confused.
If I run my exe manually, it bombs out trying to read 0x00000000. If I run it from mcvc++, (control-f5 or whatever, I just go to Build, Execute ), it works fine.
WTH?
If I run my exe manually, it bombs out trying to read 0x00000000. If I run it from mcvc++, (control-f5 or whatever, I just go to Build, Execute ), it works fine.
WTH?
Did u create g_pDisplay "g_pDisplay = new CDisplay(...)" before using g_pDisplay->SomeMethod();
I only see that you declared g_pDisplay and initialized it to NULL.
Alaa,
I only see that you declared g_pDisplay and initialized it to NULL.
Alaa,
if you wanna use directx, i''d recomend to learn it instead of using other peoples stuff...
that personall though
that personall though
PHIRO said:"Well, now I am *really confused.
If I run my exe manually, it bombs out trying to read 0x00000000. If I run it from mcvc++, (control-f5 or whatever, I just go to Build, Execute ), it works fine.
WTH? "
Running ur program by using +F5 and running it directly has a difference because of the path. Ur *.exe file is in the ..\debug foder by default, so function such as LoadBitmap("BitmapFileName.bmp"); may failed because those files are not in the debug folder, right?
I think alaa_m is right, first of all make sure that ur g_pDisplay has been created succesfully and that it's a valid "Object".
[edited by - remi on October 2, 2002 9:12:17 PM]
If I run my exe manually, it bombs out trying to read 0x00000000. If I run it from mcvc++, (control-f5 or whatever, I just go to Build, Execute ), it works fine.
WTH? "
Running ur program by using +F5 and running it directly has a difference because of the path. Ur *.exe file is in the ..\debug foder by default, so function such as LoadBitmap("BitmapFileName.bmp"); may failed because those files are not in the debug folder, right?
I think alaa_m is right, first of all make sure that ur g_pDisplay has been created succesfully and that it's a valid "Object".
[edited by - remi on October 2, 2002 9:12:17 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement