I’ve been running this OpenGL Globe screensaver I wrote for several years now on various machines without any issues. Until the other night when I installed it on my new laptop. So I did a little digging and figured out what was going on. After I installed the screensaver and tried to activate it I got the following error:
Googling for information brought me to this site. Further down in the discussion they start talking about switchable graphics with the AMD drivers (which I have) and the Catalyst control center. It seems that by default screensavers are run in “Power Saving” mode with hardware acceleration disabled. Well, since this is an OpenGL screensaver that just will not do! I open up the Catalyst control center and it’s not listed in the recent applications. I guess since it hadn’t run yet it wouldn’t show up. Of course, the Browse… button on the Other Applications box below won’t allow you to select a .scr file. So I try right clicking the .scr file to try to test it that way:
Hey, it starts! So I jump back into the Control Center and there it is!
I set it to “High Performance” and go back to the screensaver control panel and it starts right up! Interesting. I’m not sure if or how I could update the installer to detect and adjust these settings automatically. I’ve been running this screensaver (or previous builds of it) on various computers for several years now and this is the first time I’ve encountered an issue with it. I’m not sure if I can even consider it an issue with the screensaver or not though I’d argue either the screensaver or the installer need to be updated since I can’t really expect end users to have to jump through hoops to get my software to work. I’m probably not going to do it any time soon however. If you have an idea for fixing this problem in an automated fashion I’d be interested in hearing it. If you’d like to play around with the installer code let me know and I’ll give it to you. In the mean time, if you see this issue, let me know if this fixes it.
Update 3/12/2013
So, I’ve been playing around with the drivers and mucked things up enough that I had to revert. However, when I installed the original version and encountered the same problem with the screensaver described above, the above fix did not work this time! Grrr… To get around it I had to go in and manually add it in the registry. One of the existing screensavers that actually ran without issues was listed in the Switchable Graphics dialog as shown above. I picked ribbons.scr. I opened regedit32.exe and searched for “ribbons.scr”.
I edited this string value and changed the path to specify “ssglobe.scr” instead of “ribbons.scr”. When I reopened the Switchable Graphics dialog it was listed though it was marked as “Not Assigned”. I’m sure there are other registry settings that can be updated to add it and give it the proper settings all in one shot. However, getting it to show up in the dialog is sufficient for now as the settings can then be changed from there. I set it back to “High Performance” and all is again working.
I’ve been running this OpenGL Globe screensaver I wrote for several years now on various machines without any issues. Until the other night when I installed it on my new laptop. So I did a little digging and figured out what was going on. After I installed the screensaver and tried to activate it I got the following error:
Googling for information brought me to this site. Further down in the discussion they start talking about switchable graphics with the AMD drivers (which I have) and the Catalyst control center. It seems that by default screensavers are run in “Power Saving” mode with hardware acceleration disabled. Well, since this is an OpenGL screensaver that just will not do! I open up the Catalyst control center and it’s not listed in the recent applications. I guess since it hadn’t run yet it wouldn’t show up. Of course, the Browse… button on the Other Applications box below won’t allow you to select a .scr file. So I try right clicking the .scr file to try to test it that way:
Hey, it starts! So I jump back into the Control Center and there it is!
I set it to “High Performance” and go back to the screensaver control panel and it starts right up! Interesting. I’m not sure if or how I could update the installer to detect and adjust these settings automatically. I’ve been running this screensaver (or previous builds of it) on various computers for several years now and this is the first time I’ve encountered an issue with it. I’m not sure if I can even consider it an issue with the screensaver or not though I’d argue either the screensaver or the installer need to be updated since I can’t really expect end users to have to jump through hoops to get my software to work. I’m probably not going to do it any time soon however. If you have an idea for fixing this problem in an automated fashion I’d be interested in hearing it. If you’d like to play around with the installer code let me know and I’ll give it to you. In the mean time, if you see this issue, let me know if this fixes it.
Update 3/12/2013
So, I’ve been playing around with the drivers and mucked things up enough that I had to revert. However, when I installed the original version and encountered the same problem with the screensaver described above, the above fix did not work this time! Grrr… To get around it I had to go in and manually add it in the registry. One of the existing screensavers that actually ran without issues was listed in the Switchable Graphics dialog as shown above. I picked ribbons.scr. I opened regedit32.exe and searched for “ribbons.scr”.
I edited this string value and changed the path to specify “ssglobe.scr” instead of “ribbons.scr”. When I reopened the Switchable Graphics dialog it was listed though it was marked as “Not Assigned”. I’m sure there are other registry settings that can be updated to add it and give it the proper settings all in one shot. However, getting it to show up in the dialog is sufficient for now as the settings can then be changed from there. I set it back to “High Performance” and all is again working.
I like to dabble in different things, 3D graphics being one. Here is a free screensaver I created a while back using OpenGL to display a rotating 3D globe. It’s pretty simplistic but I think it’s cool. Here’s a screenshot taken from my laptop.
The globe is created by mapping a flat image of the earth onto a 3D sphere. The image was obtained from NASA’s Visible Earth website out of the Blue Marble collection. This version supports multiple monitor setups and provides high and low resolution textures for the globe (though I haven’t really tested to see if the different resolution textures really make a difference). The screensaver does not change your monitor resolution and will run at whatever the current resolution is set at. Obviously an OpenGL capable graphics card is required. I also created a msi installer for it. I just wanted an excuse to play with the WiX toolkit for creating install packages. The screensaver can be downloaded from here. If there is interest I have some ideas for enhancements like city lights on the night side, real-time sun tracking, perhaps cloud cover or any other suggestions. Let me know what you think.
Update 12/3/2012
Ok, after having run this screensaver on several different computers over several years without ever having any problems, I just tried to install this on my new laptop and it failed with a DLL error.
Not sure what the issue is at the moment but I’ve previously installed this screensaver on Windows XP 32-bit and Windows 7 Professional (which I also have on this laptop) without problems. It’s late now so I’ll look tomorrow to see what’s going on and post an update.
Update 2 12/5/2012
So I found a fix for the issue and posted a new article about it. Let me know if you run into the same issue or if you find any other problems.
Here’s an easy one that stumped me for a bit. How do you remove a drop shadow from an object in Inkscape? This guy had the answer:
Select the object, then from the filters menu (where you would normally apply a filter), select “Remove Filters” at the bottom. This will remove all the filters applied to that object, not just the drop shadow filter, but it gets the job done!
DjDoom is a reference implementation for the original Doom game engine that I have been working on for a little while. The purpose of this project is to build a playable Doom engine from the original Linux source code with minimal changes necessary to build and run in a Windows environment.
This was created as a learning tool for me and I’m publishing this so it can be a learning tool for others. It is intended that this be a base for others to build and expand on.
I deliberately chose to not use any third party libraries to handle sound, input and graphics and instead used only what is usually available on a typical Windows platform. I use DirectX 8 for graphics and input (including keyboard, mouse and joystick).
The sound utilities took the most effort to write since Windows does not make it easy to play MIDI music and sound effects. Learning to use the Windows Multimedia APIs to play MIDI resulted in a few other articles on this blog.
The game engine is built on Windows using MinGW. You will also need the DirectX 8 SDK. Newer DirectX no longer includes Direct Draw and won’t work for this code. DirectX 8 SDK comes with Windows Game Programming for Dummies, Second Edition which is where I got it from.
The original DooM code was released by iD Software under the GPL. The additions I made are released under a more permissive MIT license.
C:/DXSDK/include/dmdls.h:81: error: declaration of `WLOOP _DMUS_REGION::WLOOP[1]'
C:/DXSDK/include/dls1.h:264: error: changes meaning of `WLOOP' from `typedef struct _rloop WLOOP'
typedef struct _rloop {
ULONG cbSize;
ULONG ulType; /* Loop Type */
ULONG ulStart; /* Start of loop in samples */
ULONG ulLength; /* Length of loop in samples */
} WLOOP, FAR *LPWLOOP;
The WLOOP type is used in a struct in dmdls.h:
typedef struct _DMUS_REGION
{
RGNRANGE RangeKey;
RGNRANGE RangeVelocity;
USHORT fusOptions;
USHORT usKeyGroup;
ULONG ulRegionArtIdx;
ULONG ulNextRegionIdx; /* If zero no more regions */
ULONG ulFirstExtCkIdx;
WAVELINK WaveLink;
WSMPL WSMP;
WLOOP WLOOP[1];
} DMUS_REGION;
It seems MinGW doesn’t like the member variable with the same name as its type. I changed the definition of the WLOOP member variable to use the actual type rather than the typedef’ed alias:
C:/DXSDK/include/dmdls.h:81: error: declaration of `WLOOP _DMUS_REGION::WLOOP[1]'
C:/DXSDK/include/dls1.h:264: error: changes meaning of `WLOOP' from `typedef struct _rloop WLOOP'
typedef struct _rloop {
ULONG cbSize;
ULONG ulType; /* Loop Type */
ULONG ulStart; /* Start of loop in samples */
ULONG ulLength; /* Length of loop in samples */
} WLOOP, FAR *LPWLOOP;
The WLOOP type is used in a struct in dmdls.h:
typedef struct _DMUS_REGION
{
RGNRANGE RangeKey;
RGNRANGE RangeVelocity;
USHORT fusOptions;
USHORT usKeyGroup;
ULONG ulRegionArtIdx;
ULONG ulNextRegionIdx; /* If zero no more regions */
ULONG ulFirstExtCkIdx;
WAVELINK WaveLink;
WSMPL WSMP;
WLOOP WLOOP[1];
} DMUS_REGION;
It seems MinGW doesn’t like the member variable with the same name as its type. I changed the definition of the WLOOP member variable to use the actual type rather than the typedef’ed alias:
So, a while back I had set up a Linux machine with an older QuadroFX video card to do some 3D stereo programming. The nVidia Linux drivers installed without a problem and everything seemed to be working. Except for the stereo part. Trying some test applications this is what I found:
$ ./pulsar -s
ERROR: Internal error <Visual with necessary capabilities not found> in function fgOpenWindow
Poking around the internet turned up little about this problem. However, from /usr/share/doc/NVIDIA_GLX-1.0/README.txt I found this little tid-bit: Workstation overlays, stereo visuals, and the unified back buffer (UBB) are incompatible with Composite. These features will be automatically disabled when Composite is detected. Simply running: “nvidia-xconfig --no-composite” fixed it. Looks like it added the following to xorg.conf:
So, a while back I had set up a Linux machine with an older QuadroFX video card to do some 3D stereo programming. The nVidia Linux drivers installed without a problem and everything seemed to be working. Except for the stereo part. Trying some test applications this is what I found:
$ ./pulsar -s
ERROR: Internal error <Visual with necessary capabilities not found> in function fgOpenWindow
Poking around the internet turned up little about this problem. However, from /usr/share/doc/NVIDIA_GLX-1.0/README.txt I found this little tid-bit: Workstation overlays, stereo visuals, and the unified back buffer (UBB) are incompatible with Composite. These features will be automatically disabled when Composite is detected. Simply running: “nvidia-xconfig --no-composite” fixed it. Looks like it added the following to xorg.conf:
Set up MinGW
This article will show you how to set up a MinGW DirectX development environment. First, you need to get the latest and greatest MinGW development environment. The easiest way to do this is to download and run the latest mingw-get-inst GUI installer. Select the directory to install MinGW. Make sure that this path contains no spaces. Select the C++ and MSYS optional components.
This will download and run the Command line installer. You will see a console window open while it downloads and installs the selected components. Once the installation completes you must add the MinGW bin/ directory to your path, for example C:\MinGW\bin.
Start the MSYS shell by running C:\MinGW\MSYS1.0\msys.bat. In this MinGW shell, run the /postinstall/pi.sh script to establish bindings between the MinGW and MSYS installations. Just say yes.
Other packages may be installed manually following the manual install instructions found here.
Set up the DirextX SDK
Download the latest DirectX SDK. Microsoft likes to keep moving things around but as of this writing it can be found at this link https://msdn.microsoft.com/en-us/directx/. Run the installer and install to a directory without spaces, for example C:\DirectXSDK.
The latest DirectX SDK is installed but it is not yet visible from within the MSYS environment. In the root directory /, create an empty /dxsdk subdirectory. This will be used as a mount point for the DX SDK. Edit the file /etc/fstab and add the line “C:/DirectXSDK /dxsdk“. The hard drive path and the mount point may be separated by any number of spaces or tab characters. Go to /dxsdk and list the directory contents. If it is empty you probably have a typo in fstab. Also, older MinGW versions did not automatically reload the mount points when fstab was modified. You may need to exit your shell and restart it.
Build and run the test application
I borrowed the following test application from DirectX Tutorial.com. If everything was set up properly it should build and run with no modifications.
dxtest.cpp
Build the DirectX test application with the following command:
-I/dxsdk/include – specifies additional include directories to search
-L/dxsdk/lib – specifies additional library directories to search
-DUNICODE – defines the UNICODE preprocessor symbol for unicode strings
-ld3d9 – link to the d3d9.dll
You can run the DirectX test application by typing:
./dxtest.exe
Note that if you try to run this program outside the MinGW environment, for example double clicking it in explorer, you may get a dialog box complaining about not being able to find libgcc_s_dw2-1.dll. This is probably because you didn’t close explorer and open it again after you added MinGW to your path. Ensure that C:\MinGW\bin is in your path. Explorer “should” pick up the change immediately but for some reason it doesn’t always. Close and reopen your explorer window.
This brings up an interesting point however. Our application is dependent on a dll shipped with the MinGW environment. If we are to redistribute our executable, we must also redistribute the dll or our users will not be able to run our application. One way to fix this is to link the gcc run time statically:
This does however have the drawback that it has the potential to dramatically increase the size of our executable. Choose what works best for your situation.
Also note, now that we are able to run our application outside the MinGW shell, a console window opens up along with our application. This is ugly and not something we really want. To get rid of this console window we need to specify that we are building a windows application using the -mwindows option:
Thats it! Have fun with DirectX and MinGW! These are the exact steps I’ve taken and they worked for me today. Tomorrow a new version of something might break things. Let me know what issues you uncover and I’ll try to keep this up to date.