View Full Version : placing numbers either integer or float on screen

11-25-2002, 05:12 PM
Hi all,
is there any function which places numbers (integers or float)on the screen directly.
i know the function glutBitmapCharacter(),
which can put only characters on the screen.

please dont suggest me to convert them to ascii and then use glutBitmapCharacter(),
i am doing the same.
but i want another method , which directly places the numbers on the screen.

my application requires to add 2 quantities and display the result along with the individual quantiies.

please help me out as soon as possible.

thanks in advance,
have a nice day

11-25-2002, 07:10 PM
you have to use sprintf to convert it into a string and then render it

11-25-2002, 07:11 PM
im am suggesting this to you because its the only way. thats why you have no other replies

11-25-2002, 07:21 PM
please give me the format for the same.
i want to read a integer from array and then place it on the screen as it is.

11-25-2002, 08:48 PM
Check out either the bitmap or the outline font tutorial at:

11-28-2002, 01:42 AM
thanks mdog1234,
sprintf worked out.
hope the same kind of help from u in the future also.
bye bye
have a nice day

11-28-2002, 03:56 AM
Hiya, I know this is solved now but.... I am not sure what sprintf is, but I used :

public void RenderStringLarge(String renderStr, double x, double y){
gl.glRasterPos2d(x, y);
glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN _24, renderStr);

and then called it where 'score' is an int and 470 and 460 are the co-ords where to display it:
RenderStringLarge ("Score : " + score, 470, 460);

This is in Java.... as I said, not sure what sprintf is, so it may be the same :-)