![]() |
|
Graphical problems with video bitmaps |
The Unknown
Member #8,441
March 2007
|
On a different computer to that which the game was compiled on, i get this lovely effect on my backgrounds. And as you can see from the screen shot, the test monkey is not happy. {"name":"screenshotel7.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/3\/034e3f62570350aef1fc484ee8ccec2b.png","w":803,"h":481,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/3\/034e3f62570350aef1fc484ee8ccec2b"} The reason you can see some rings, a small man, and an angry looking monkey. Is because i have a video bitmap for writing large bitmaps to, to save some RAM (by using the VRAM) so this includes backgrounds etc. All other non-static objects are drawn to a memory bitmap. Once all the drawing is done, the memory bitmap is placed atop the video bitmap, and the video bitmap is displayed on the screen. So, the backgrounds are video bitmaps, they are blitted to the video buffer, all should be good right? Well apparently it isn't. I put this code at the beggining to check that blitting VRAM to VRAM, was hardware accelerated: if(!(gfx_capabilities & GFX_HW_VRAM_BLIT) || !(gfx_capabilities & GFX_HW_VRAM_BLIT_MASKED)) allegro_message("Oh no...");
It said nothing so... i don't know whats going on :-\ |
Paul whoknows
Member #5,081
September 2004
![]() |
First, you should allways allow your game to work with a simple and nice double buffer system. Quote: to save some RAM (by using the VRAM) I am not sure if that's a good idea, usually most systems have more RAM than VRAM. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
The Unknown
Member #8,441
March 2007
|
I'm only using about 20MB of the VRAM, so its not big deal. And it worked fine when i was only using memory bitmaps.
Thats the background, thats what goes all crazy. masked_blit(Buffer, VideoBuffer[Page], 0,0,0,0,800,480); show_video_bitmap(VideoBuffer[Page]); And its not just random computers that do this, it seems to be any compy without allegro installed. |
Kitty Cat
Member #2,815
October 2002
![]() |
How are you loading them into VRAM? Quote: save some RAM (by using the VRAM) Note that many systems will keep a copy of VRAM bitmaps in RAM as well in case the VRAM bitmaps get corrupted and need to be "refreshed". -- |
The Unknown
Member #8,441
March 2007
|
Err... BITMAP* Foreground = create_video_bitmap(RoomWidth, RoomHeight); ... BITAMP* Temp = load_bitmap("Levels\\Jungle.tga"); blit(Temp, Foreground, 0,0,0,0, RoomWidth, RoomHeight); ... destroy_bitmap(Temp);
Quote: Note that many systems will keep a copy of VRAM bitmaps in RAM as well in case the VRAM bitmaps get corrupted and need to be "refreshed". Even if that happens, i still get an extra 5FPS, ooh. Not that anybody will ever notice :-\ |
Kitty Cat
Member #2,815
October 2002
![]() |
Should probably change that to: BITAMP* Temp = load_bitmap("Levels/Jungle.tga"); BITMAP* Foreground = create_video_bitmap(Temp->w, Temp->h); ... blit(Temp, Foreground, 0,0,0,0, Temp->w, Temp->h); ... destroy_bitmap(Temp); (with proper error checking) in case the bitmap you're loading is a different size than what RoomWidth and RoomHeight are. Quote: Even if that happens, i still get an extra 5FPS, ooh. Not that anybody will ever notice :-\ Not to dissuade you from using VRAM bitmaps, as it's a perfectly fine method. Just don't think you're saving RAM because of it. Also, you're creating your video bitmap buffers first, before loading your images? Since the first video bitmaps created overlap the screen... -- |
The Unknown
Member #8,441
March 2007
|
the RoomWidth and RoomHeight are the width and height of jungle.tga Quote: Also, you're creating your video bitmap buffers first, before loading your images? Since the first video bitmaps created overlap the screen... Huh? All this stuff is done once when loading the level... after which the screen is cleared and drawn to. Anyway, ive decided that it too much effort, and gone back to double buffering. I also imagine the performance boost given by using video bitmaps, would depend on the card so... |
|