Looks like you need to call setCustomFullScreenRectangle after you change
the display settings so that Producer knows about the changes. Otherwise
the rendersurface doesn't adjust to the new size of the screen resolution:
const Producer::Camera* cam = m_poCamera;
Producer::RenderSurface* rs =
(Producer::RenderSurface*)cam->getRenderSurface();
if( rs->getDrawableType() != Producer::RenderSurface::DrawableType_Window
){
return;
}
rs->setCustomFullScreenRectangle( 0, 0, _newDisplay.dmPelsWidth,
_newDisplay.dmPelsHeight );
Zach
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zach Deedler
Sent: Tuesday, October 31, 2006 11:26
To: 'osg users'
Subject: RE: [osg-users] osgScreenResolution
I found a bug in the code listed before. The code would cause the
application to crash on exit. To restore old display settings do this:
ChangeDisplaySettings(NULL,0);
Here is the final code:
WIN32
If you are running on Windows then you could do it manually. Perform the
following on startup:
//Create new display settings
DEVMODE newDisplay;
memset(&newDisplay,0,sizeof(newDisplay));
newDisplay.dmSize=sizeof(newDisplay);
newDisplay.dmPelsWidth = 1024;
newDisplay.dmPelsHeight = 768;
newDisplay.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
//Modify display
if(ChangeDisplaySettings(&newDisplay,0) != DISP_CHANGE_SUCCESSFUL) {
//failed to set display mode
}
Then do the following before your application exits:
//Restore old display settings
ChangeDisplaySettings(NULL,0);
Zach
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zach Deedler
Sent: Tuesday, October 31, 2006 09:32
To: 'osg users'
Subject: RE: [osg-users] osgScreenResolution
Hi Robert,
I searched the archives a bit and found this from Farshid at least:
WIN32
If you are running on Windows then you could do it manually. Perform the
following on startup:
//Save current display settings
DEVMODE oldDisplay;
memset(&oldDisplay,0,sizeof(oldDisplay));
oldDisplay.dmSize = sizeof(oldDisplay); EnumDisplaySettings(NULL,
ENUM_CURRENT_SETTINGS, &oldDisplay);
//Create new display settings
DEVMODE newDisplay;
memset(&newDisplay,0,sizeof(newDisplay));
newDisplay.dmSize=sizeof(newDisplay);
newDisplay.dmPelsWidth = 1024;
newDisplay.dmPelsHeight = 768;
m_newDisplay.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
//Modify display
if(ChangeDisplaySettings(&newDisplay,0) != DISP_CHANGE_SUCCESSFUL) {
//failed to set display mode
}
Then do the following before your application exits:
//Restore old display settings
ChangeDisplaySettings(&oldDisplay,0);
Zach
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
Sent: Tuesday, October 31, 2006 09:27
To: osg users
Subject: Re: [osg-users] osgScreenResolution
Hi Zach,
On 10/31/06, Zach Deedler <[EMAIL PROTECTED]> wrote:
> Anybody know of a cross-platform way of setting the screen resolution
> independent of the desktop settings?
I don't believe Producer has anything to force a change in display
resolution, Don will be able to give a definitive answer to this.
I have used SDL in the past, and it certainly does have the ability to force
a specific screen resolution.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/