Text in OpenGL .... question from a newbie

Started by
7 comments, last by RBC9 23 years, 5 months ago
Hi guys , First , sorry for my english , it s not my language , and i was not a good student .... In fact , i m a newbie in graphics (not only there :-) ), i m looking for some help. Like i said, i ll learn how to do ... , but i would be able to create a small application for my personnal usage now. I would know if it s possible to send text in OPENGL game , like Half-Life / Quake or other ... I want to have a program with some alarm , that put text at the screen while i m playing. I ve got no problem to handle event i need , phone , Mail .... I ve try to use standart Windows API (BitBlt) but the text is flashing and it s impossible for me to read what i send ... So , if someone has time to spent , i would be happy to have a little example that i can modify for my purpose. thx.
Advertisement
??
The best (read: quickest) way I''ve found to display text in GL is to render a textured polygon for each character.

Start with a texture that contains all the characters you want to be able to print. You''ll probably want to have an alpha channel in it so the non-character part is transparent.

Then do display a string, take each character one at a time. For each character, determine the texture coordinates needed to show the proper portion of the texture, then render a quad (or two triangles) using those tex coords.

Let me know if you need any more details.

Morbo
yep he''s right that is one of the best ways to do it - GDI and BitBlt seem to be completely incompatible with how OpenGL works... so you just can''t use them in opengl programs.

NeHe has a tutorial about it...
[email=ehremo@hotmail.com][/email]
There's also a very nice c++ class for it available here.

____________________________________________________

"Two wrongs do not make a right; it usually takes 3 or more."



Edited by - Ratheous on November 2, 2000 6:57:19 PM

____________________________________________________
"Two wrongs do not make a right; it usually takes 3 or more."
Some mistakes are too much fun to only make once.
Never anger a dragon, for you are crunchy and you go well with brie.

What about Bitmap fonts? These thingies created from true type fonts. NeHe has a tutorial about it. Why shouldn''t you use that? is it too slow?
Does anyone have any experiences with that?

"Mr Sandman bring me a dream"
-----------------------------"Mr Sandman bring me a dream"
the problem is not really the font / text or bitmap.

I want to send text in Game. So when i play with Half-life for Example , i can bring some text to prevent me on mail arrival.

I try to reach the device context of the games , getdc , getwindow and getwindowtext , but how put text in and how can i do to avoid flicking. StencilBuffer ? how use it ?
i m really bad in opengl.
Oh, sorry. I seem to have missed the whole point about this post.
Interesting concept though, to manipulate other OpenGL Applications from another application.
Would really like to know if you got it to work (when you got it working).

Good luck!

"Mr Sandman bring me a dream"
-----------------------------"Mr Sandman bring me a dream"
Help plz...

This topic is closed to new replies.

Advertisement