# Thread: how to write text below a point on the screen

1. ## how to write text below a point on the screen

My screen renders some pixels. I also want to render/write the x y coordinate of every point below it. Could anyone please tell me what function I shall use to accomplish this.

2. Rendering text is no easy task, unless you're working with some library that helps you out, if by chance you were using windows, then WinAPI could help you with that.
I'm pretty sure every OpenGL Wrapper Lib nowadays has some functions to get the position of a pixel, unless you wanted to render info regarding x,y coordinates of a vertex. Rendering such text would be exactly like rendering any other object, you'd specify the position (or more precisely, you'd specify positions of vertices, unless it was an image :P) at which you want to render specified image / function that prints a number.

The easiest and most idiotic way to do it, just to test things out, would be to go into any Paint-like program, and make a couple of images to output at desired points, a more advanced way to do it would be to get interested in fonts and try to make a system that would take a letter from a file and print it at a certain point. Unfortunately, I don't think any of those methods are easy to implement. You could also make a couple of funtions with hard-coded positioning of vertices to render text, something like this

Code :
```void Print[Number](GLint x, GLint y, GLint z)
{
//specify the vertices, and just add x,y,z respectively
}```

Although, this method is pretty stupid too

3. Usually the utility that opens a window for you (such as Glut) provides character and/or string routines. You simply call the routine with the (x,y) coordinates of the point in question and the string is drawn to the screen. If you want a string drawn below a point, you add small deltas to x and y. I actually use Glut string routines in my simulations even though I open my windows with another library.

4. Originally Posted by Carmine
Usually the utility that opens a window for you (such as Glut) provides character and/or string routines. You simply call the routine with the (x,y) coordinates of the point in question and the string is drawn to the screen. If you want a string drawn below a point, you add small deltas to x and y. I actually use Glut string routines in my simulations even though I open my windows with another library.
I do not understand how your method is implemented. However, I found this link for my problem. is this a good method? http://en.wikibooks.org/wiki/OpenGL_...1#Introduction

5. Did you just seriously put up a link to a file on your computer ? How in Seven Hells did you even get to programming ?

Anyways, find the actual page that file refers to and put the actual WWW link here.

6. Originally Posted by Decesive
Did you just seriously put up a link to a file on your computer ? How in Seven Hells did you even get to programming ?

Anyways, find the actual page that file refers to and put the actual WWW link here.
I was disconnected. That's why I sent the wrong link mistakenly. Can you please hold your horses. It happens sometimes.

7. Originally Posted by saman_artorious
I do not understand how your method is implemented. However, I found this link for my problem. is this a good method? http://en.wikibooks.org/wiki/OpenGL_...1#Introduction
It's easier than what your link describes. For example, if you are using GLUT or FreeGlut, there's a routine(s) that display characters or strings. They provide a limited selection of sizes and font types. Here's a link ....

http://www.csim.scu.edu.tw/~chiang/c...pCharacter.pdf

Use glRasterPos to move to a location near the point (x,y), then call the character/string routine.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•