[Gameplay3d] development-basic knowledge of 3D Game Development

Source: Internet
Author: User

[This article introduces direct3d initialization. I feel like the basic concept is almost the same .]

First, let's take a look at some basic concepts of 3D games.

Device)
In Program Another concept often mentioned in design is device. What is a device? A device is a computer hardware, that is, a physical device used for drawing graphics. We can understand it as a computer display card. Because direct3d has encapsulated the process of direct access to hardware, we need to create a device interface to use this interface for drawing our images.
Buffer)
The color buffer (frame buffer), also known as the target buffer, is a block of memory in the system memory or video memory. It corresponds to a two-dimensional display area to be displayed. During the drawing process, direct3d completes coordinate transformation, illumination processing, and texture ing, stores the pixel values of the drawing results in the color buffer, and refresh the image, the color buffer content is displayed on the screen.
Both the front-end buffer and the back-end buffer are color buffers. The front-end buffer is mainly used for screen refresh and is also visible. The background buffer is mainly used for drawing the image. After the drawing is complete, the two perform page flip and display the processed image.
Page Flipping)
What is page flip? First, let's learn how movies work. The film uses 24 consecutive flashing images every second. The difference between each image is very small. Due to the stranded human eyes, we can see that the picture is continuous. Direct3d also adopts this working mode. We plot the object to be displayed to an invisible page. We call this page "post-buffer ". After the painting, quickly flip it to the visible "front buffer" and repeat the process. When the user is watching the newly drawn visible page (front buffer), the program will draw the next thing to display to the "back buffer. After a fast and continuous Repeat process, you can see images that are as continuous as movies. However, in general, we can draw more pages per second than movies.
If we do not use page flip technology, the objects on the screen that the user sees will be drawn one by one. Although the speed may be very fast, the effect will be poor, that's not what we want.
We often need to draw continuous graphics, so our game needs a loop called "game loop ". In each loop, we need to clear the "post-buffer" and draw the drawn object to the above according to a certain logic. However
Then it is moved to the "front buffer" and then enters the next loop. This cycle ends until the game exits. Sometimes we may need several "backbuffers" (multiple buffers) to form a "swap chain" for better results.

As mentioned above, in direct3d, a device object contains at least two display cache zones: front buffer and back buffer ), the former can be seen as the directing of direct3d windows. When rendering a graph, we do not output it directly in the window, but draw it in the backup cache area. After rendering, swap two cache zones to change the original backup cache area to the current cache area to refresh the window, as shown in. Repeat this process quickly to form a continuous animation on the 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.