Skip to main content
GameDev.net gamedev.net
🔒 Locked

NVRotate from C++ ??

Started by Prune Jan 7, 2009 at 3:06 PM 0 replies 1.7k views
Original Post
Prune
Prune
I need to rotate the Windows desktop to portrait mode from within my C++ program. I can do it from the NVidia control panel, but how do I do it from C++? Some Win32 API call instead of NVRotate is fine as well, as long as the hardware cursor also gets rotated as NVRotate does. I cannot use ChangeDisplaySettingsEx() since EnumDisplaySettingsEx() shows only 0 for allowable display orientation, and thus NVRotate must be doing the rotation through some other call to the NVidia driver :( [Edit] This seems to work, in case anyone else needs this sort of thing: system("rundll32 NvCpl.dll,dtcfg rotate 0 90"); Now, how do I do it on Linux? [Edited by - Prune on January 7, 2009 4:10:37 PM]
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
outRider
outRider
Try the RandR extension first; you can use the xrandr program from the command line to try rotate your display, there is help all over the web on it. If that works you can do it from your program with the system call or by linking with libXrandr and calling the right functions.

If that doesn't work (I don't know how well Nvidia's closed source driver supports RandR), you can try the NVCONTROL extension. Nvidia provides the nvidia-settings program, which you can use from the command line or as a GUI application, and it is also open source so you can see what functions it calls to get rotation using NVCONTROL.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.