![]() |
|
blit crash! |
khristina yer
Member #5,795
May 2005
![]() |
I have this piece of code: blit(graphicpack.background[0],drawto.drawon(), 0,0,0,0,800,600);//draw demon background.
it crashes at this point. what could I be doing wrong to cause allegro to crash? |
miran
Member #2,407
June 2002
|
Post more background information. More code, circumstances in which it happens, etc... -- |
khristina yer
Member #5,795
May 2005
![]() |
this is where graphicpack.background[0] gets loaded. BITMAP* DrawEngine::drawon() { return drawimage[which]; } This is where drawimage[which] gets created. drawimage[0]=create_video_bitmap(x,y); drawimage[1]=create_video_bitmap(x,y); of course I did do error checking so I know they are there. I really don't know what other details I can post, without handing out the src code. it crashes at the blit. It sets the video mode, loads the graphics, reserves video memory, and then when I try to do the blit, it will crash. would blitting from a memory bitmap to a video memory bitmap cause this problem? |
miran
Member #2,407
June 2002
|
Quote: would blitting from a memory bitmap to a video memory bitmap cause this problem? I don't think so. Blit crashing usually indicates that there's something wrong with at least one of the bitmaps in question. What are the values of x and y in create_video_bitmap()? Do you set the colour depth after setting the gfx mode? Do you load the background and/or create the video pages before setting the gfx mode? Does the same happen if you use memory back buffer? -- |
khristina yer
Member #5,795
May 2005
![]() |
Quote: What are the values of x and y in create_video_bitmap()? 800 x 600 y in this test run. Quote: Do you set the colour depth before setting the gfx mode? yes I set it to 16 Quote: Do you load the background and create the video pages after setting the gfx mode? yes it sets the resolution and then I load the background and create the video pages. I don't know whats wrong. [edit] Also I saved grahpicpack.background[0] to a file, and it looked fine. |
miran
Member #2,407
June 2002
|
Try to create a minimal example that shows the problem and post the code (all of it, with main() and everything). Should be around 20 lines. -- |
khristina yer
Member #5,795
May 2005
![]() |
I compiled and tested this code. It did not crash. It did just what I wanted it to do. |
umperio
Member #3,474
April 2003
![]() |
If your code is not secret, nor very long maybe you could try posting it, so we can give a debug at it. I know it's not the problem, but I prefer the following: which = 1 - which; which is cleaner. |
khristina yer
Member #5,795
May 2005
![]() |
The code is very long, but I'll make a attachment. Please be gentle with the criticism. |
miran
Member #2,407
June 2002
|
EDIT: Posted before the last post That only shows the problem is not with blitting the background to a video bitmap but somewhere else. Try to create a minimal example that shows the problem and post the code. --------- -- |
khristina yer
Member #5,795
May 2005
![]() |
Quote: I noticed that background0.bmp isn't an 800x600 bitmap. It's 800x54... Thats strange! All of my programs report it as 800x600. I used gimp to make it. Do you think gimp has it messed up somehow? |
miran
Member #2,407
June 2002
|
Sorry, my mistake. I'm having problems with my image viewer program... -- |
umperio
Member #3,474
April 2003
![]() |
At first, the problem seems to be related to graphicpack.background[0] not being loaded correctly, in fact blitting a loaded bitmap to drawto.drawon() works perfectly, but saving graphicpack.background[0], gave an image which cannot be open. I wonder how you managed to save it. |
khristina yer
Member #5,795
May 2005
![]() |
The next crash would probably be another blit. Well I can't find out whats wrong. I've checked the address of background it self, It looks like it loaded. The background isn't loading correctly. But why is everthing reporting that its fine? Is it getting lost somewhere? I'm going to try and blit the freshly loaded image before that function ends. [REPORT] |
|