Text Display

Hi all,

Does anyone know of any clever way to allow the user to type in values so as to update some variables in the programme?

for example,instead of using mouse input, an user can type in 10, and there will be ten spheres drawn… Does anyone know how to do that?

most games have a debug console for entering commands. sounds like this is what you’re after. present the user a prompt on the screen to enter text, then process the command in your app.

for example:

> create_spheres 10

then just parse the string “create_spheres 10” in your app.

Hi,

Thanks for the reply.

I think I may not have expressed my queries well enough.

I meant to ask about user input of data in the process of running the opengl program as described below.

For instance, the user may indicate that he wants to draw spheres by clicking a ‘button’. The program should then display a ‘field’ of white space for the user to type in an integer value (to indicate how many spheres he wants).

The field should be in the same window as the rest of the opengl scene, probably in a corner. Does anyone know how to create the field, and most importantly, how to retrieve the value the user types in?

If you use glut, glui is a good option. Not very fast but gets the job done easily. Another options is that you do the painful tasks of drawing the white space yourself, then expect keyboard input and on each number typed draw the number. On the next number move to the left and redraw… You get the picture.