View Full Version : text overlay
04-30-2002, 06:30 PM
I've got a strange question, I was hoping some knowledgeable person here could point me in the right direction. I need to display text on the screen while a game is running, however the code that displays the text would not be part of the game. A good example of this would be the Fraps utility www.fraps.com (http://www.fraps.com) . This utility displays the frames per second of any directx or opengl game however fraps is not part of the game. It is a utility that runs from windows that counts the fps and then displays the number on top of the game display. I need to display a number on top of the game screen. I'm unsure of what method I would use to do that. Would I use directx, or is there another way to do it? Thanks for all your help.
05-01-2002, 02:45 AM
As far as I know a common tecknik is to set your font (letter/number/symbols) in an image. The letters/numbers have to be separate by the same distance.
To display one of these letters on screen, draw a surface (POLYGON, TRIANGLE or whatever...) upon which you bind the texture you made from the font image.
Then use texture coordinate to select the coordinate of the letter in the image and alpha-blend it so that only the "interior" of the letter is displayed.
-> don't forget to set font image alpha value correctly.
A good technique is to build a function that make the relation between a char and texture coordinate so that you just have to call :
displayText("cool text example");
[This message has been edited by MPech (edited 05-01-2002).]
05-01-2002, 07:39 AM
Thanks for your reply. I can display text no problem. I made a borderless window that's always on top and displayed my text there using "glCallLists" in the manner explained by this tutorial. http://nehe.gamedev.net/tutorials/lesson.asp?l=13
The text display fine, however when I try to start an opengl game (UT) the game crashes when it loads. If I set the game to Direct3d the game starts fine but my opengl text is displayed behind the game screen not infront where I want it. I must be doing something wrong. Or this is not the method to use. I need a method that will allow other openGL apps to start while my text display runs in the background (yet displaying visible on top of the game screen). Thanks for your help.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.