Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Multiple monitors

This topic is 5271 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

Hello all Is it possible to use a dual-monitor video card it the following manner ? First monitor should contain a management interface Second monitor should contain a full screen opengl rendering device controlled by the interface displayed on the 1st monitor Can you direct me to some example showing a dual monitor setup for a simple application ? Thank you very much spanac

Share this post

Link to post
Share on other sites
In general (there are specific exceptions), OpenGL will not use hardware acceleration on anything except the primary display. Any rendering done on secondary displays (or windows that span displays) will all be done in slow, software mode. So for your question, you''ll want to consider putting the managment interface on the secondary monitor, and the OpenGL rendering on the primary.

Share this post

Link to post
Share on other sites
Ok, this is no problem. All i want is display some text
in OpenGL mode but i need full screen.
I want to use the tv-out for utputing the full screen opengl
texts and the monitor for the interface. I want to be able
to modify the texts displayed by opengl using the interface.
On ATI videocards i saw there is an option with which i can
specify which output is the primary one (i can select the tv-out
as being my primary display and the monitor as being the
secondary one). I guess i can do the same with nvidia also.
My problem is however the way i can spread the two things
(opengl window and application window) onto two displays.
Can you help me ? I have been reading a few articles but i could
not find a specific one. In one there was a talk about extending
the desktop onto the second display and then create a viewport
that is maximised on that one. Do you think this is the only
possible way or is there a way to specify the display no# when
i create the opengl window ?
Thank you again for your time


Share this post

Link to post
Share on other sites
Multi-monitor support can be a real can of worms. For example, sometimes multi-monitor displays are treated as one device and must have the same resolution and sometimes they are treated as two devices can can have separate resolutions. The one device ones frequently turn off the secondary monitor if you go full screen on the first. The best way to do full screen reliably is to make a window that is sized to the full screen if you can afford to do that.

Here is a quick and dirty program the creates a window that fills each monitor:

#include <windows.h>
#include <vector>

// Get monitor rectangles

BOOL CALLBACK MonitorEnumCallback(
HMONITOR hMonitor, // handle to display monitor

HDC hdcMonitor, // handle to monitor DC

LPRECT lprcMonitor, // monitor intersection rectangle

LPARAM dwData // data

std::vector<RECT>* pvRectangles = (std::vector<RECT>*)dwData;

pvRectangles->push_back( *lprcMonitor );

return TRUE;

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
if ( GetSystemMetrics( SM_CMONITORS ) == 1 )
MessageBox( 0, "There is only one monitor on this system", "One Monitor", MB_ICONERROR );
// Get the rectangles for each locical screen

std::vector<RECT> vScreenRectangles;
EnumDisplayMonitors( 0, 0, MonitorEnumCallback, (LPARAM)(&vScreenRectangles) ); // I KNOW, I'm Assuming that a DWORD and a poiter are the same size, my bad!

int i = 1;
for ( std::vector<RECT>::iterator it = vScreenRectangles.begin(); it != vScreenRectangles.end(); ++it )
RECT r = *it;

// Determine if it's the primary monitor

bool bPrimary = r.left == 0 && r.top == 0 && r.right == GetSystemMetrics (SM_CXSCREEN) && r.bottom == GetSystemMetrics (SM_CYSCREEN);

char szTitle[80];
sprintf( szTitle, "Window %i - %s Monitor (Press Escape Key to exit)", i++, bPrimary ? "Primary" : "Secondary" );
CreateWindow( "static", szTitle, WS_VISIBLE | SS_CENTER, r.left, r.top, r.right - r.left, r.bottom - r.top, 0, 0, hInstance, 0 );

// Message loop...

MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
// Exit if the escape key is pressed

if ( msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE )

return 0;

[edited by - mauman on April 20, 2004 3:55:59 PM]

Share this post

Link to post
Share on other sites
Taking the code posted by MauMan, can''t you capture the HDC of the monitor in MonitorEnumCallback and use it to create your HRC and then do all your rendering?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!