Jump to content
  • Advertisement
Sign in to follow this  
FILO

OpenGL Dual screen seport with OpenGL

This topic is 3955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All, I am just wondering what is the earliest version of OpenGL that supports rendering to two contexts (dual displays) from within one application. I know its possible with OpenGL 2.0 on OSX, is it possible to do this on windows and linux. SDL currently does not allow displaying to multiple displays from within one application. I am thinking about switching over to OpenSceneGraph, does this seem like a good move. Any feedback would be most appreciated. Thanks. -H

Share this post


Link to post
Share on other sites
Advertisement
GL doesn't define anything related to displays.

For Windows:
If you have 1 card with 2 or more outputs, then most likely you have hw acceleration on all outputs.
If you have 2 cards that are from 2 companies, the first card will have hw accel and the second will run the MS generic software implementation.
If you have 2 cards from same company (nVidia), then your OK. At least I have heard that it works for some people. I don't know if the 2 cards need to be of the same generation or not.
I don't know about 2 ATI cards.

With 2 cards, you can make 1 window for 1 monitor, another window for the other.

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
GL doesn't define anything related to displays.

For Windows:
If you have 1 card with 2 or more outputs, then most likely you have hw acceleration on all outputs.
If you have 2 cards that are from 2 companies, the first card will have hw accel and the second will run the MS generic software implementation.
If you have 2 cards from same company (nVidia), then your OK. At least I have heard that it works for some people. I don't know if the 2 cards need to be of the same generation or not.
I don't know about 2 ATI cards.

With 2 cards, you can make 1 window for 1 monitor, another window for the other.


Thanks Vman, do I need to setup multiple gl contexts, one for each monitor?

Share this post


Link to post
Share on other sites
Not sure whether this will help but here goes...
If you're using different rendering contexts then you are probably best to create one window object for each context.
If your generic window type for drawing OpenGL is called, for example, GLWindow - then simply do
class LeftWin : public GLWindow
class RightWin : public GLWindow

Then you can do different things with each new Window type. Or have some virtual functions set up in the generic type so again the implementation is different.

As for getting one window to display on one monitor and one on the other (I think that's what you want) try one of these...

LeftWin::LeftWin() // Left Window constructor
{
SetPosition(0,0); // sets position of window to top left of all displays
}

RightWin::RightWin() // Right Window constructor
{
if(GetSystemMetrics(SM_CMONITORS) > 1) // if more than 1 monitor
{
SetPosition(GetSystemMetrics(SM_CXSCREEN),0); // draw on 2nd monitor
}
}

Obviously this will not work as intended if the monitors are vertically aligned!

Hope that helps.
Will-O

Share this post


Link to post
Share on other sites
Thanks for all the help guys I really appreciate it.

According to xrandr my linux system has one virtual screen (screen 0) that has the dimensions 2048x768 and is composed of two LVD's display's (1`024x768) labeled LVDS-1 and -2.

At the moment I am wading through various tutorials and examples (one from the blue book chapter 21), trying to get my head around developing xlib applications. Specifically, I want to be able to create a window which fully occupies both LVDS-1 and LVDS-2.

At present I am trying to figure out how to get a window to appear at a specified location. I am attempting to do this using the XCreateWindow function however the coordinates I am inputing for the top left corner of the window seem to have no effect of where the window ends up being displayed. I am guessing this has something to do with a Window Management policy.

So my question's would be, how do I get windows to display full screen and or at specified locations.

Also, I am considering buying the green book OpenGL Programming for the X Window System (OpenGL) (Paperback) but the amazon reviews indicate it's a little out of date. Any one care to comment on this or offer up another glx/linux oriented opengl programming book? Thanks.

Share this post


Link to post
Share on other sites
In case any one is interested, this is one way to get a window to fullscreen with xlib:


XEvent e;
int operation = 1;//set to true
Atom atom_state = XInternAtom(display, "_NET_WM_STATE", False);
Atom atom_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);

memset(&e,0,sizeof(e));
e.xclient.type = ClientMessage;
e.xclient.message_type = atom_state;
e.xclient.display = display;
e.xclient.window = window;
e.xclient.format = 32;
e.xclient.data.l[0] = operation;//1 for true 0 for false
e.xclient.data.l[1] = atom_fullscreen;

XSendEvent(rcx->dpy, DefaultRootWindow(rcx->dpy), False, SubstructureRedirectMask, &e);


I was able to use both lcds by creating two windows, fullscreening one on the first screen and moving the second to the second screen and full screening it there.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!