Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: My score is displaying funny numbers, need help!

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    17

    My score is displaying funny numbers, need help!

    Ok so I used one of my old codes which displays the integer 0 next to "score" at the beginning of the program

    However in my current program every time I run the program it displays 'score' but instead of displaying 0 next to it, it displays random numbers such as 37363160 and every time i run the program the random numbers change from the previous one.

    note: when i click on the window the random numbers blink....

    Why isn't it displaying 0? My friend tried the exact same code and it worked for him

    Here's my code in order the important parts)


    char displayscore [10]; // string
    int score = 1;
    void renderBitmapString(float x, float y, float z, void *font, char *string)
    {
    char *c; glRasterPos3f(x,y,z);
    for (c=string; *c != '\0'; c++) {
    glutBitmapCharacter(font, *c);
    }
    }
    and in my void renderscene


    glColor3f(0.0f,1.0f,0.0f);
    //glTranslatef (25.0, -31.0, 20.0);
    sprintf(displayscore,"Score %u");
    renderBitmapString(-250,180,0.0,GLUT_BITMAP_HELVETICA_12,displayscore) ;

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    17
    sorted

    next to %u, I missed the score....

    so sprintf(displayscore,"Score %u", score);

    little things lol

Posting Permissions

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