I\'m creating a game but I have one problem: how can I draw text to the screen, as I want to print something every time the player picks up something or gets hurt. I already
In OpenGL there is no function / method you can call to render text to the screen.
You have two choices: either 1) use a library; or 2) roll your own, creating your own calls to render text to the display.
1) There are a number of different libraries out there that you could use to render text to the display; however the most obvious and accessible to you is within GLUT. There are two calls within that you could use:
glutBitmapString() and glutStrokeString()
The first of these will render text to the display in what I guess could be referred to as a 2d manner (looking like it's pasted right of the display). The latter with display 3d text.
You can refer to
http://freeglut.sourceforge.net/docs/api.php
for API references.
2) You could create a function / method that renders character textures to the display using the standard OpenGL functions, or you could potentially use stencil buffers using calls to glDrawPixels() to generate the characters.
I haven't tried these: I'm just thinking off the top of my head so you're mileage may vary. Good luck.