3D to the Windows desktop (+ source)

    3D models on the desktopMerry Christmas dear Khabravchians!

    I want to selflessly share their modest project .

    Key features:

    • 3D graphics output (models, scenes) to the Windows desktop;
    • transition to screensaver and back;
    • import of models;
    • setting the last 3D frame with a desktop picture;




    Background


    The project was completed in September 2011, when the official site was ready , since then I have not remembered and did not do the project at all.
    There were two prerequisites for the creation: that it was possible and that it was something amazing, I mean covering the desktop with a live 3D picture, it fascinated me at first (especially the rotating tiger from the DirectX lessons on a bright blue desktop background) , there are some fantasies to take off, I thought. Of course, there are enough ways to animate the desktop now, but I have not seen solutions like mine.

    Operating principle


    If you describe the whole process, then everything is quite simple:
    • getting the main window of the system (the lowest window in the hierarchy of desktop windows);
    • initialization and display of 3D graphics on the main window;
    • setting the transparency of the layers above the main window;
    • and setting hooks on user actions on the desktop.

    Piece of code
    hP = FindWindow(L"ProgMan", NULL);	
    hD = GetDesktopWindow();
    if (!SUCCEEDED(InitD3D(hD))) { FatalError( L"Can't init Direct3D" ); ExitProcess(NULL);}
    SetWindowLong(hP,GWL_EXSTYLE, GetWindowLong(hP,GWL_EXSTYLE) | WS_EX_LAYERED );
    UAC_hook = SetWinEventHook( EVENT_SYSTEM_DESKTOPSWITCH, EVENT_SYSTEM_DESKTOPSWITCH, NULL, WinEventCallback, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNTHREAD);
    

    By the way, the source code is presented in a rather unusual form, more than 3,000 lines of code and all in one file, this is due to the first experience of C ++ and DirectX.


    disadvantages


    The only drawback due to which the solution could not be called correct is the output of 3D graphics on the desktop to the main window, which in principle is not intended for this.

    I would like to warn that the program consumes an unequal amount of resources on different computers and operating systems, i.e. can use <1% CPU on one computer and> 40% on another, about the same configuration (better performance on Windows XP). Use sleep mode - double click on the tray icon.

    Application


    3D models on the desktop
    In addition to rendering wallpapers from different angles of the 3D model, even with photos of relatives or a calendar (yes, the calendar that gave us the dear anatoly_rr for the new year ), you can try to find several useful applications for this solution, such as:
    • output of information of secondary importance, whether it is: a system for monitoring a house or the movement of trucks on a map;
    • 3D logo output on screens in an office or store.


    Import Models


    I did everything, including models, alone, and of course they may not be to everyone's liking, I understand.
    Importing your own model will not be difficult, especially if you own a 3D editor, yesterday I specially created a small manual for importing 3D models from 3Ds Max, there is also a video on youtube . There are several nuances, because, as you probably guessed, the shadows are not drawn on the fly, and the export takes place to the good old * .X file . If you have wallpapers, discard them, I will share them in a special section . Thanks for attention!

    References


    Project site: michael.verhov.com/project/full3dwallpaper
    Official: full3dwallpaper.com
    GitHub: github.com/verhov/full3dwallpaper
    A little video: www.youtube.com/watch?v=zkVRyfxRGn0

    Also popular now: