![]() |
|
Slow blitting in windowed mode? |
axilmar
Member #1,204
April 2001
|
Hi, I've got the following code:
Blitting is very slow...the same code in full screen mode is so fast that I can't see the circle moving, while in windowed mode it moves very slowly. Does anybody know something about this? |
Marcello
Member #1,860
January 2002
![]() |
All I can imagine is it's hardware accelerating video-video in fullscreen, and not in windowed? Maybe add some acquire/release bitmaps calls? Marcello |
Evert
Member #794
November 2000
![]() |
Never acquire video bitmaps if you're doing vram->vram blits. You should only acquire bitmaps if you're going to do non-accelerated operations on them. Just about the only circumstance in which you should use acquire_screen()is if you're doing a memory->vram dirty rectange system. EDIT: in other words, drop the acquire()/release() calls. |
Paladin
Member #6,645
December 2005
![]() |
Are you trying to use page flipping? If so, where do you flip the pages at? Why don't you look at Shawn Hargreave's examples since he has something very similiar to this in the double buffer and page flipping examples. |
axilmar
Member #1,204
April 2001
|
Even if I drop the acquire/release, the problem remains. I am not trying to use page flipping, but buffering from vram. I think maybe the problem is due to pixel conversion...because If I reduce the color depth to 16, then the speed is more than doubled. |
Evert
Member #794
November 2000
![]() |
What's your desktop colour depth? |
Felipe Maia
Member #6,190
September 2005
![]() |
Is there a way to get the desktop color depth? |
Evert
Member #794
November 2000
![]() |
Yes. |
Richard Phipps
Member #1,632
November 2001
![]() |
If you put the circlefill itself outside the inner loop, does that give you a significant speed up? |
axilmar
Member #1,204
April 2001
|
Quote: What's your desktop colour depth? 32 bpp, as it is in the code. Quote: If you put the circlefill itself outside the inner loop, does that give you a significant speed up? The circlefill is already outside of the inner loop. |
Richard Phipps
Member #1,632
November 2001
![]() |
while (!keypressed()) { circlefill(page2, x, SCREEN_H / 2, 64, makecol(255, 255, 255)); acquire_screen(); for(int j = 0; j < SCREEN_H / 32; ++j) { for(int i = 0; i < SCREEN_W / 32; ++i) { blit(page2, screen, i * 32, j * 32, i * 32, j * 32, 32, 32); } } release_screen(); ++x; } You are drawing the circle every frame, and drawing directly to video memory is known to be pretty slow. If you could just blit the circle (but time the frame rate) you would have a better idea of how slow the blitting is.. |
axilmar
Member #1,204
April 2001
|
Quote: You are drawing the circle every frame, and drawing directly to video memory is known to be pretty slow. I don't think so. Only translucent drawing is slow on vram. Quote: If you could just blit the circle (but time the frame rate) you would have a better idea of how slow the blitting is.. The same code in full screen runs so fast you can not see the circle moving; all you see is a big white stripe. Maybe there is conversion of pixels between RGB (which vram uses) and BGR format (which Windows uses); allegro devs could confirm this. |
Richard Phipps
Member #1,632
November 2001
![]() |
Quote: I don't think so. Only translucent drawing is slow on vram. If your hardware is accelerating some primitives like GFX_HW_LINE then you might get fast drawing. Otherwise it could be the cause of the slowness. All I'm saying is it could be worth testing to see if it is this than spending a lot of time on the blitting and gfx mode side. |
axilmar
Member #1,204
April 2001
|
Quote: If your hardware is accelerating some primitives like GFX_HW_LINE then you might get fast drawing. Otherwise it could be the cause of the slowness. All I'm saying is it could be worth testing to see if it is this than spending a lot of time on the blitting and gfx mode side. No, I've already said that: if you do the test in full screen mode then it is so fast you don't see the circle moving, just a big white stripe. So it is definitely not the drawing. If you also remove the for loop and do the blitting with one call, speed is good. The trouble is with tiled blitting. |
Evert
Member #794
November 2000
![]() |
Quote: Maybe there is conversion of pixels between RGB (which vram uses) and BGR format (which Windows uses); allegro devs could confirm this.
If they knew about Windows programming and the innerworkings of the DirectX driver... maybe. |
Richard Phipps
Member #1,632
November 2001
![]() |
Axilmar: Ah, I misunderstood. My apologies! If things are that slow it sounds like the display is being converted or emulated in software somehow. Do AllegroGL programs also run slowly for you in a window? |
|