|
|
This thread is locked; no one can reply to it.
|
1
2
|
| So what's Allegro doing special ... |
|
23yrold3yrold
Member #1,134
March 2001
|
Okay, I've mentioned this before. I'm making a little program for my class that draws up a window on the second monitor of the computer, which is set up to be displayed at the front of the room via projector. Works fine and dandy, and there's been three versions. One that's just an Allegro GFX_AUTODETECT_WINDOWED, one that's Win32 and OpenGL, and one that's Win32 and uses Allegro to draw the double buffer to the device context via draw_to_hdc(). Those last two are made with the class style WS_POPUP and just drawn to cover the second monitor, making it appear fullscreen (the pure Allegro program I just drag over there Now, I'm hammering out the final version of this thing after all my experimenting. And the third program setup works the best for me; I can use all the fancy Win32 GUI stuff with the simple Allegro graphics routines. Works great. One catch: it's slow. Like, really slow. Like runs at a quarter the speed of the other two programs slow, at best. Now I assume this is an issue with hardware acceleration of some kind. The other two programs are fine so I know the machine is (barely) capable. The pure Allegro setup won't work because I need a dialog box or two and it's got the ugly border. The Win32/OpenGL version is okay, but OpenGL is a pain to set up compared to Allegro, plus the Allegro code is already done anyway (the Win32/OpenGL test was actually a completely seperate program). So, I'd really like to know what Allegro is doing that it works fine in the plain version, but runs so slow in the Win32 version. I'm guessing there's some DirectX of some kind running in the background? How hard would it be to add that as a wrapper between Allegro and Win32? I've never used DirectX. Should I just bite the bullet and do the best I can with OpenGL 2D and Win32, and forget Allegro? I'm hoping someone with insight into Allegro's guts can tell me how hard it is to reproduce what it's doing. Otherwise I'll just go with OpenGL, clumsy as I am with it. I can try to provide some skeleton code of any of these programs if it would help. -- |
|
GullRaDriel
Member #3,861
September 2003
|
Quote: I can try to provide some skeleton code of any of these programs if it would help. I will try to make some test if you do so. "Code is like shit - it only smells if it is not yours" |
|
Marco Radaelli
Member #3,028
December 2002
|
If I'm right, blit_to_hdc() should rely on GDI, not on DirectX. Do I understand correctly that you have one Allegro application that needs to go fullscreen on the second monitor? So it's not a matter of multiple windows? I won't have any real solution, though. [edit] A quick look at the sources under /win shows that function is in gdi.c, so I guess I'm right.
|
|
Milan Mimica
Member #3,877
September 2003
|
isn't blit_to_hdc() slow as hell?
-- |
|
Evert
Member #794
November 2000
|
Yes. |
|
Thomas Fjellstrom
Member #476
June 2000
|
Quote: isn't GDI slow as hell? Fixed. -- |
|
GullRaDriel
Member #3,861
September 2003
|
GDI is always slow as hell. "Code is like shit - it only smells if it is not yours" |
|
ImLeftFooted
Member #3,935
October 2003
|
I know less than you do about the guts In case you didn't see my thread and do decide to go the OpenGL route yet don't want to learn OpenGL, you could look at my library: If you do decide to learn OpenGL, maybe my code will make the learning process easier? I'd try to analyze bitmap.h and bitmap_hardware.cpp As for getting OpenGL up and running (albeit this isn't that difficult), you can look for that in conf.cpp Also note this: In Conf.cpp you have included aldumb.h... this file is not needed. I don't think I got around to fixing that line of code before the thread closed :-X |
|
Richard Phipps
Member #1,632
November 2001
|
If he switches to OpenGL, we will never see TMS! |
|
23yrold3yrold
Member #1,134
March 2001
|
The Masters of the Obvious said: isn't blit_to_hdc() slow as hell? isn't GDI slow as hell? GDI is always slow as hell. Yes, thank you all. Now, on to how we might rectify it, and more specifically, if anyone knows how Allegro in particular does it ... -- |
|
Marco Radaelli
Member #3,028
December 2002
|
Quote: I can use all the fancy Win32 GUI stuff with the simple Allegro graphics routines. Works great. One catch: it's slow. Like, really slow. Like runs at a quarter the speed of the other two programs slow, at best. 02:20 am idea (so discard it if sounds strange, tomorrow I'll reread it ^_^): Can't you have all the fancy Win32 GUI stuff in a window and have Allegro manage its other? Or even use a pipe to connect a Win32 program to the Allegro one, and you pass anything you get from the Win32 GUI program to the Allegro program through the pipe or some other IPC system?
|
|
Milan Mimica
Member #3,877
September 2003
|
The are many Allegro GFX drivers, some of theme are GFX_GDI and GFX_DIRECTX, go figure how allegro does it in each of the two cases.
-- |
|
23yrold3yrold
Member #1,134
March 2001
|
MR: no, because the whole point is the Allegro window is ugly. MM: I'd love to "go figure how", but the Allegro source code does not make for light reading the last time I examined it. :p DD: Can I use that with Win32? I already know OpenGL fairly well, the point is to avoid re-writing old code that already works fine in Allegro. I may just bite the bullet and go that path if I can get it running at a decent speed though .... -- |
|
Thomas Fjellstrom
Member #476
June 2000
|
Quote: Yes, thank you all. Now, on to how we might rectify it, and more specifically, if anyone knows how Allegro in particular does it ... The GDI driver is slow. Always has been. The faster drivers are all DirectX/DirectDraw. -- |
|
Milan Mimica
Member #3,877
September 2003
|
In the other words, there is nothing special Allegro doing in GFX_GDI mode.
-- |
|
23yrold3yrold
Member #1,134
March 2001
|
That's not very helpful. I didn't ask what Allegro was doing special "in GFX_GDI mode" ... Screw you guys; I'll just use OpenGL. -- |
|
Thomas Fjellstrom
Member #476
June 2000
|
That's why we mentioned DirectX. IT USES DIRECTX!. I hope you read that this time. -- |
|
23yrold3yrold
Member #1,134
March 2001
|
Did you read it when I said it in the original post as well? -- |
|
Thomas Fjellstrom
Member #476
June 2000
|
Oh, threre is, win_set_window will let you give allegro your own window. or win_get_window, and you can MODIFY allegro's. -- |
|
23yrold3yrold
Member #1,134
March 2001
|
There, now that's information I might actually be able to use. -- |
|
Thomas Fjellstrom
Member #476
June 2000
|
win_set_window HAS to be done before a call to set_gfx_mode iirc. -- |
|
Nicol Bolas
Member #9,238
November 2007
|
Quote: Oh, threre is, win_set_window will let you give allegro your own window. If I may offer a counterpoint, I haven't had much luck getting win_set_window to work. Allegro 4.2.2's input system doesn't seem to behave itself very well when you use this. I've also noticed a number of other posts about win_set_window that have shown problems with various bits of Allegro when trying to use it. It may be that the feature needs work, or has suffered bit rot.
|
|
ImLeftFooted
Member #3,935
October 2003
|
23yrold23yrold said: DD: Can I use that with Win32? I already know OpenGL fairly well, the point is to avoid re-writing old code that already works fine in Allegro. I may just bite the bullet and go that path if I can get it running at a decent speed though .... It runs on windows as well as linux. On linux you must compile with NO_D3D=1. If by win32 you mean to ask if it can be placed inside a win32 control, then no. |
|
aj5555
Member #9,033
September 2007
|
GDI is slow for a number of reasons;
however.. if you match up the allegro version (32bit/16bit) with the desktop depth, and your DONT have windows spanning 2 desktops, then its wicked fast! if your data for that screen is already in a suitably packed RGB structure, look at the GDI function StretchDiBits() to get the desktops DC, call GetDC(NULL); regarding your windows without borders etc, that is easy to do also.. by changing the win32 windows style info in the CreateWindow() another hack i do, used shared memory, and copy it into another running process like a SDL window. i have heaps of these multi-screen methods, at least one of them ought to work for you. |
|
Thomas Fjellstrom
Member #476
June 2000
|
Quote: however.. if you match up the allegro version (32bit/16bit) with the desktop depth, and your DONT have windows spanning 2 desktops, then its wicked fast! Two requests: -- |
|
|
1
2
|