Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Kenny Ho

OpenGL Chinese character in OpenGL

This topic is 6296 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I''m newbie in OpenGL. How can I display a chinese character in OpenGL? Could anyone give me a example please? Thank you .

Share this post


Link to post
Share on other sites
Advertisement
Chinese characters are difficult, simply because there''s so many of them. Now, I''m no linguist, and I don''t know any chinese, so my assumptions about the characters may be wrong, but the way I do it is to have a "character cache". Say you store the last 100 characters drawn in some cache, and whenever you go to draw a new one, you check if it''s in the cache and just use that, if not, you flush one of the old characters and draw this one in (perhaps using GDI, or your own rendering function, or maybe even loading the glyph from disk). It''s not lightning fast, but I don''t think you''re going to find any lightning fast methods (that don''t use enormous amounts of memory).

This would work well if you have a few commonly used characters and the rest are only used now and then (even better if they''re usually used more than once in any given sentence/phrase).

Like I said, I don''t know Chinese, so I don''t know if those are valid assumptions.

If you''re new to OpenGL, though, I would recommend you forget about Chinese characters and just use English characters (or some other language where the actual management of the glyphs is not a concern). Come back to the problem when you know a bit more.


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Create a character map in your favourite graphics program, with all the characters using an equal amount of space. Load it into opengl, and when writing the text out to the screen, bind to the character map texture, and set the texture coordinates to the character you wish to display.

Share this post


Link to post
Share on other sites
That would be something cool.

I don''t think he wants to draw them BY HAND.

Isn''t there some way to display foreign True Type characters in Windows
using GDI? If there is, just use GDI to draw them on a bitmap and display
them.

But you did not specify if you wanted 2D or 3D extruded text. I think there
is a way to do both.

Share this post


Link to post
Share on other sites
quote:
Original post by Dean Harding
Maximus, you do realise that there''s around 14,000 chinese characters, don''t you?


codeka.com - Just click it.


You''re point being? If he is determined enough to do it, then he will do it. If it isnt too important or he isnt determined enough, he wont do it.

It just means that it will be one hell of a big character map.

And to answer your question, no. I dont speak chinese, only english, a little indoneasian, and very little japanese.

Share this post


Link to post
Share on other sites
You can use wglUseFontOutlines function to create display lists and then use glCallLists to render the chinese words.
You can search the MSDN for a text3d screensaver sample code,I myself referenced this code
If you still can''t figure out how to do that,please feel free to contact me at xiangping@263.net,i''ll show you my code to handle that if you like.

Share this post


Link to post
Share on other sites
*this is just flames and ranting, please ignore*
O my God are you guys ignorant... Frankly I really don''t even understand why I goto this website when the average IQ around here is room temperature... Although someone actually had a *gasp* good Idea of using the windows built in ''3D text'' charachters, 1.) It wouldn''t be support for full manderin chinese and 2.) Your talking about literally eating memory.

The obvious solution is to simply have a 32-bit texture (One containing the alpha channel) of the word roots, as well as phenitic hints. Then (although by hand) you could construct your various kanji from those radicals w/o the need to store a seperate graphic. Such as ''rest'' being composed ''man'' and ''tree'', simply have the two textures, then render them side by side with the alpha test enabled.

I am very dissapointed in the ''l33t''

CodeSmith the Pixel Pusher
www.cs.trinity.edu/~csmith8

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!