How to Use font in d3d

Source: Internet
Author: User

D3dxfont

In this section, we will discuss the application of direct3d to implement some 3D applications, sample some terrain technologies, particle systems, pick up, and construct a flexible 3D camera. In addition, we take some time to explore the d3dx Library (special mathematical components), which is briefly described in this chapter.

Chapter 2, "font"-during the game, we often need to display some information to users. In this chapter, we can integrate and output text in direct3d.

Chapter 2, "meshes Part 1"-This chapter thoroughly explains the data and methods of the d3dxmesh interface id3dxmesh.

Chapter 2, "meshes Part 2"-in this chapter, we will continue to learn d3dx mesh-related interfaces and functions. We learn about. X Files and how to load and render them. In addition, we test the progressive mesh interface id3dxpmesh. This chapter also shows how to calculate the range box and the range ball.

Chapter 2, "constructing a flexible camera"-in this chapter, we design and implement a flexible camera with six degrees of free rotation. This camera is suitable for flight simulation and first-person shooting.

Chapter 2, "Basic terrain rendering"-This chapter shows how to create textures, light, and 3D terrain. What's more, we show how a smooth Mobile Camera does not exceed the reminder, and it looks like it is on the terrain.

Chapter 2, "Particle System"-in this chapter, we learn how to use small particles to construct a model system in a small style. For example, particle systems can be used to simulate snow and rain, sparks and explosions, smoke particles, rocket tracks, and even gun bullets.

 

Chapter 2, "pick up"-shows how to use the mouse to pick up special models. It is usually a necessary user interface in 3D games and applications.

Chapter 4 font

In the game room, we often display original user information. This section describes three ways to output text in d3d. Each method conforms to the computing file of a simple web page application.

Target

Learn how to use the id3dxfont interface to render text

Learn how to use the cd3dfont class to render text

Learn how to calculate the value of each frame

Learn how to create and render 3D text using the d3dxcreatetext Function

Id3dxfont

The jd3dx Library provides the id3dxfont interface to draw text in direct3d applications. This interface is usually drawn using the GDI interface, so we have this interface in terms of performance. However, id3dxfont can handle complex fonts and use GDI to format them.

Create an id3dxfont font

We can use the d3dxcreatefontindirect function to create a font.

The following code snippet shows how to use this function:

Logfont lf;

Cd3dfont-Mode

The DirectX SDK provides some useful code for the \ samples \ c ++ \ common folder dxsdk root directory. There is a cd3dfont class that uses texture triangles and direct3d to display rendered text. Since cd3dfont uses direct3d to render instead of GDI, It is faster than id3dxfont. However, cd3dfont does not support complex font formats. If you need to perform self-tuning, you can use the cd3dfont class. To use the cd3dfont class, you need to add the following file to d3dfont. h, d3dfont. CPP d3dutil. h d3dutil. CPP, dxui. h dxutil. CPP. these files can be found in the SRC folder.

Use FreeType font

D3dxcreatetext

The final function creates the text of 3dmesh. Figure 9.1 shows the 3D text mesh. The fontmesh3d example is rendered in chapter.

Deviation-Extrusion

After creation, you can use the drawsubset (0) of id3dxmesh to display a simple 3D font.

To support complex formats, use the id3dxfont interface to render fonts. This interface uses GDI to render text and thus reduces performance.

Use cd3dfont to render simple fonts. This class uses texture triangles and direct3d to render text and therefore is faster than id3dxfont.

Use d3dxcreatetext to create the string text of 3dmesh.

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.