Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro with multiple monitors

This thread is locked; no one can reply to it. rss feed Print
Allegro with multiple monitors
Louis S
Member #5,503
February 2005

Does anyone know how to make Allegro display on one external monitor with a different display on the laptops lcd display? I am trying to write a scoreboard program with a display being output to a TV and controlled by the laptop. I would greatly appreciate any help.

Matthew Leverton
Supreme Loser
January 1999
avatar

I think you will have to run the program in Windowed mode and drag (or positition it) it to the other monitor. Using the Win32 API you could probably create a window without any toolbars/borders and resize it to fit the second display. Then you could attach Allegro to it.

Louis S
Member #5,503
February 2005

What do you mean by attach Allegro to it? Is there some kind of way to write to the buffer that goes to the other screen or whatnot? I've never dealt with multiple monitors before. To be honest, I didn't know Allegro had a windowed mode. Can it have multiple windows at once since one would be the display window and the other would be for controlling it?

Steve Terry
Member #1,989
March 2002
avatar

Good luck there, you could run windowed sure, create two running programs with some sort of shared file/memory system so one knows what the other is doing... not sure. As far as allegro is concerned with windows there is only one screen and monitor, it cannot go to another one. Also a laptop can only output one screen too, unless you have dual video cards or dual screen capability. Just write one program and show all the screen contents onto a projector or something, I've done that before with allegro, you can see the screen on the laptop and the projector at the same time.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Louis S
Member #5,503
February 2005

I can't display the same contents onto each display. The laptop needs to display controls and setup options while the laptop's output will show the compiled results which are run into a video switcher and overlayed with the live video signal. Think of it as a character generator for sports games and the like. We can't afford a real one so we figured we can pull off something simple.

Steve Terry
Member #1,989
March 2002
avatar

Use two laptops and TCP/IP... you can't get a laptop to have two separate pages of video memory, what's on the screen is what is sent out as video out as well.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

What do you mean by attach Allegro to it?

win_set_window

Quote:

Can it have multiple windows at once since one would be the display window and the other would be for controlling it?

Allegro cannot, but you might be able to create two via the Win32 API. Allegro could be attached to the second window. However the controlling window would then be written in Win32 code, and not Allegro.

Personally, I don't think what you are trying to do is something that Allegro can do very well. Future versions will probably be better with multiple windows, but I doubt you can wait a few years for that to happen...

You could create hacks to work around limitations. For instance, you could write two Allegro programs and communicate back and forth by dropping text files in a directory or sending messages.

Edit, I was beaten...

Quote:

Also a laptop can only output one screen too

No, laptops can output two different screens. Mine can. The LCD is one desktop and the TV is another.

Steve Terry
Member #1,989
March 2002
avatar

Oh ok, if you can do that, I wasn't sure. Then create two programs and communicate via TCP/IP on 127.0.0.1, not hard :P

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Louis S
Member #5,503
February 2005

About the laptop, I apologize, that is what I meant. One screen is LCD built into laptop, the other is video out. I think I will try the multiple program hack. As long as I can make the output all pink except what I want drawn then it is good enough. I don't know enough about windows api to bugger around with that stuff. I may try the thing suggested by MidoriKid at http://www.allegro.cc/forums/view_thread.php?_id=326345 first.

- Edit -
Communicate via TCP/IP? That does sound hard. I will look into that. That would probably be more appropriate than a text file.

Steve Terry
Member #1,989
March 2002
avatar

Louis, the socket API is not that hard, I have some stuff if you want it or hit up BAF to help you with it, he loves that stuff :)

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Louis S
Member #5,503
February 2005

If you have a link to a good tutorial that would be awsome. Most of the ones i've come across have been kinda dense.

relpatseht
Member #5,034
September 2004
avatar

I have found Beej's Guide to Network Programming to be a good resource.

A J
Member #3,025
December 2002
avatar

what platform are you using ?
windows ? linux ?

im on windows, i have several windows open at once.
all feed from a single instance of allegro.

and i can put them on seperate monitors, seperate gfx cards.

i use shared memory to transfer the data to each window, that is running in its own process.. so that they can crash seperately and not bring down each other.

___________________________
The more you talk, the more AJ is right. - ML

Louis S
Member #5,503
February 2005

I'm using windows. You can position a window on an external monitor so that the entire screen is drawable area with no border around it?

NyanKoneko
Member #5,617
March 2005
avatar

DirectX has some examples that use dual displays, totally full screen. You'll havev to do a little DX programming to set it up with allegro. I'm sure it can be done, but it might be difficult.

I bet if you use DX to set up the dual display mode, then switch allegro between windows, you can get dual display to work.

This is all theory, of course.

Tobias Dammers
Member #2,604
August 2002
avatar

Hmm... communicating through TCP/IP seems the cleanest solution to me. You should have 2 dedicated apps then, one "renderer" that produces the projector output, and a "controller". This layout has several advantages:
1) Both applications are completely independent and could run on the same machine, but also on two dedicated machines, even over a LAN or a VPN. You could control the display from your home! Having the apps communicate through a network protocol makes this very easy - all you need to do is adjust the connection settings.
2) Provided that the renderer doesn't hand anything back to the server (the controller), you could just as easily drive several renderers on different machines (even with different OSes) to display the same image.
3) You can make different controller apps, e.g. one using the windows api, one using the console, maybe even one that works through a browser.
4) You can use completely different tools for creating the client and the server. While the client might be an Allegro-based C++ program, the server may just as well be a Java application - as long as the communication protocol is well-defined.
5) You don't have to worry about thread safety, since you aren't sharing anything between threads directly.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

NyanKoneko
Member #5,617
March 2005
avatar

If what he wants to do is create one window that expands both monitors, then the TCP idea is kinda silly. I have seen DirectX demos that extended the frame buffer between two screens (so if you have two 1600x1200 monitors side by side, the game plays at 3200x1200). In this case, setting up some special directX routines to interface with allegro would probably work best.

If he wants to go all DS-like, however, and run one main game in one window, and some extra stuff (like a map in a window) on another display, then TCP would be cool because you could not only run two apps on one computer, but also on another computer, like a laptop nearby, as well. ;D

Tobias Dammers
Member #2,604
August 2002
avatar

Indeed. Didn't sound like that though.
For a single continuous surface stretching over 2 monitors, I'd say check out the gfx card specs and see if there's some sort of a "spanning" support, ie make the driver tell windows there's just one large screen and use that. Otherwise, yeah, do some dx hacking. Maybe he'll have to mod allegro, but it should be doable.
The OP sounds more like one "public" display (the score board) and one "private" display, used to interface with whoever controls the thing. For that, the separated approach is probably the way to go. If it's just a score board, then there might even be so little data that a brute-force networking approach would work: Just send all the score board data over the network a few times per second, receive on the other side and display. No timing code, no hand-shaking, just stream and display.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Louis S
Member #5,503
February 2005

Yeah Tobias, the brute force is what I'm looking at doing. The scoreboard never has to talk back to the controller since the controller stores all the meaningful data anyway. I'm still working on understanding TCP/IP stuff but I'm hoping not to have to fall back on the DX hack.

Go to: