Resolution for DirectX screenshot black screen

Source: Internet
Author: User

Why is it a black screen?

In a nutshell, black screen is caused by ddraw acceleration!

Let's start with the way DirectX is displayed, usually the data we see on the screen is sent to the display via primary surface, what is primary surface? Chinese is called the main display surface, that is to say, we currently see the screen image data from this surface, in addition to the main surface unexpectedly and off-screen surface, called Offscreensuface. The data in this surface is not displayed directly on the screen. The usual screenshot functions are basically done by intercepting the data in the primary surface. Now most of the video playback software is written in DDraw (now DDraw has fused to DirectX's graphics, DDraw the word has become a history. ), and using a surface called overlay, our usual screenshot function captures data from the normal primary surface and does not intercept data from overlay surface, and Microsoft does not provide a common API to get overlay The data in your surface, so it's not surprising that you have a black screen. The following is a black screen phenomenon when using overlay technology for Windows Media player.

Overlay is purely hardware-enabled, and DDraw does not implement this functionality with software. What's special about this surface is that it's the equivalent of a piece of plastic on the screen, which means that if you use this surface, it's on top of all your surface. When the display device displays data to the screen, it first determines if there is a overlay, and if so, displays the pixels in overlay, and if not, uses the pixels in primary surface. So, when you open a player to play the video, you will find that the player window is black. The reason is that this area corresponds to the overlay. Of course, it is not intercepted.

A detailed introduction to overlay surfaces can be seen here.

How to avoid when the black screen

Most software, in addition to the DDraw rendering mode, also provides a software renderer mode, which is software mode, which is used when DDraw acceleration is not available, so one way to avoid a black screen is to turn off ddraw acceleration, Forcing the software to use software renderer mode so that Overlay surface does not exist, it will not black screen. Specific methods are as follows

Method One: Using the software's own settings to disable overlay technology, the method only affects the software itself, in the common Windows Media player as an example, set the following (will use the Override this option to tick off, so the software will not use overlay surface)

Method Two: Using the DirectX Control Panel to turn off DDraw acceleration, the above method is equivalent to turning off the branch switch, and this method is equivalent to gross position gate closed, all other software in the system can not use DDraw acceleration. If the DirectX SDK is installed, you can open the DirectX Control Panel by entering DxDiag directly in the run bar, as set out below.

Method Three: In fact, there is a way to use the program to occupy overlay surface, this method is too troublesome, the average person will not use, because the general independent graphics support overlay surface, and the number of support is limited, so, If we use the program in advance to occupy all the overlay Surface, then the other programs can no longer be used, it will not cause a black screen. Before using this approach, you should first check to see if your video card supports overlay technology and how many are supported. If you have the DirectX SDK installed, you can expand: Start-Program-microsoft DirectX sdk-directx utilities-directx Caps Viewer, by the know, my graphics card supports a overlay Surface , I have not played the advanced graphics card, has not seen the support of multiple overlay graphics card, which brother has a good graphics card, also send a picture let younger brother look.

However, this method has a disadvantage, that is, if the software does not support software renderer mode, then if you first use the program to occupy the overlay, and then start the playback software, it will lead to errors.

The essence of these methods is, in fact, a kind of ban on the use of overlay Surface. And all of these methods have a disadvantage, that is, the need for preconceived, that is, before the software starts (or to be exact, before the video playback) to set up, and then start the software. If the video is already playing (overlay is already occupied), then these methods will be invalidated.

In addition, you can use off-the-shelf software, many software can handle the situation of black screen, such as Hypersnap 6 is very good.

How do I intercept the data in overlay?

This is not a simple question, I searched the internet for a long time, did not find a suitable method, it is said that the use of hook technology may be done, but I am not familiar with the hook, so did not try, I hope that a friend is interested to try, on this topic, Google Discussion group has a post, Introduction of the comparative details, interested can look here.

Challenge yourself!

I have a demo (download) about overlay surface. This demo is from the DirectX 7 SDK and is a flying small mosquito. Because of the older version, it is now less common online. According to the above study can be concluded that can intercept this small mosquito is not easy, interested friends may wish to try!

Reprinted from Http://www.cnblogs.com/graphics/archive/2012/04/03/2117798.html

Solutions for DirectX black screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.