Jump to content
  • Advertisement

Recommended Posts

Advertisement

I wonder if it is considered good practice to render each character from a texture to a separate quad


I don't understand the question. You _must_ render individual quads (or points that expand to quads, or some GPU-driven conversion of a text string into quads), otherwise you couldn't get anything to show up in the first place.

Share this post


Link to post
Share on other sites

You _must_ render individual quads (or points that expand to quads, or some GPU-driven conversion of a text string into quads), otherwise you couldn't get anything to show up in the first place.

 

I wonder if one draws one separate quad for each character?

Share this post


Link to post
Share on other sites
I didn't really like the approach in that tutorial for text rendering.

Instead I used a bitmap font renderer where each character is part of a texture with a known offset. It works very well and my game used to be built originally on those tutorials.

For example, see my blog post (which has in depth source code): https://www.gamedev.net/blog/1059/entry-2260816-making-my-own-spritefont-implementation/

Let me know if this helps! :)

Share this post


Link to post
Share on other sites

Instead I used a bitmap font renderer where each character is part of a texture with a known offset. It works very well and my game used to be built originally on those tutorials.

 

Interesting stuff. I also do not need transform related stuff inside the font class itself but will just add a full transformation as for other geometry.

But I am going to take a look first at DirectXTK since I want to keep the number of lib dependencies as low as possible (<> d2d1.lib).

Share this post


Link to post
Share on other sites

I wonder if one draws one separate quad for each character?


I still don't understand. I mean, yes, and that's what that tutorial does. Nothing shows up on screen where you don't render a triangle (or quad, etc.). You could render a single quad, but then you'd only be able to provide a single location on screen and a single set of texture coordinates, so you'd end up with just a single character on the screen.

One quad per character. You can use a texture atlas as others here are talking about to make it possible to use _instancing_ to render the quads, or to use a GPU vertex generation approach, but there will ultimately be one quad per character on the screen.

(There _are_ ways to use a single "coverage" quad for an entire input string, but those are advanced specialized cases that IMO are more novelty than anything.)

Share this post


Link to post
Share on other sites

One quad per character. You can use a texture atlas as others here are talking about to make it possible to use _instancing_ to render the quads, or to use a GPU vertex generation approach, but there will ultimately be one quad per character on the screen.

 

It is just difficult to grasp, that programs like Blender suffer on models of 10M triangles, whereas a screen full of text characters would be no problem. 

Share this post


Link to post
Share on other sites
I feel the quads per character approach would be faster until maybe perhaps leaning toward screen height sized font because of sample fetch(ignoring insane texture memory at that extreme). Its neat to see a vector implementation but wonder if it would be worse at tiny font sizes.

Share this post


Link to post
Share on other sites
I'm using D3D9 still. After a lot of messing with quad rendering, I finally profiled ID3DXFont and found it perfectly performant, even for a 10 line in game console.

YMMV of course, but it is so much simpler. No idea if such a thing exists in 11/12 etc.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!