Generally speaking, when programming with DirectX, one will directly create a window under the Win32 project and then perform operations on that window. However, if you have written some code with MFC, and then suddenly find that using DirectX to process the 3D display part will be more awesome, then you need to combine the two
Due to my previous research on DirectX as a beginner, I left a big shadow in my mind, so I only started working on it again recently when I was forced to do so. As a result, it was found that the integration with the MFC framework was not as difficult as imagined. Based on this article by Qian Mo, the following is a brief introduction to the process:
1. Modify the initialization function of D3D
From the initialization process of D3D in the article, it can be seen that the window handle, width, and height parameters are related to the window during initialization. If you want to present the results of D3D processing on the Picture Control control in MFC, you can obtain the window handle, width, and height of the Picture Control, and then pass them to the initialization function for assignment
2. Modify the call location of the rendering function in D3D
For the convenience of operation, this article has created a new thread specifically responsible for calling the D3D rendering function. During initialization, the D3D initialization function is called, and when the start button is clicked, the thread is called to start rendering
OK, that's all that needs to be modified. Of course, if it is to be truly applied to practical engineering, further improvement is needed and will not be repeated. The following is a schematic diagram of the modified program's running effect:
Latest
- Download Directx 11,Directx 12, Directx 10, Directx 9 free for your windows
- DirectX brief description
- DirectX Jun2010 installation error S1023
- What is DirectX11 exchange chain
- Installing the DirectX SDK
- Problems encountered in the development of directx11
- DirectX11 Learning Notes
- Introduction to 3D Game Programming with Directx12 Chapter17
- DirectX clip space and Opengl clip space
- Directx usage environment configuration
- ArcGIS Earth1.7 beta installation method - resolving the issue of 0X80070057. DirectX device creation failed
- What is DirectX and the solution to the problem of unable to open the game
- DirectX Game Development Programming Fundamentals: Directx Installation and VS2010 Testing
- Computer: taskbar cannot be clicked, DirectX error, unable to open login page solution
- DirectX11 input device - DirectInput detects mouse and keyboard status
- Can resolve DirectX symbol in engine sources UE 5
- MACBOOK installation WIN10 prompts DirectX error D3DERR_ NOTAVAILABLE
- Record an interesting debugging process of DirectX11 program flashing screen
- DirectX configuration in VS2017 environment
- DirectX11 template testing