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

Similar Threads

  1. score adn sound??
    By chign in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-04-2010, 07:00 AM
  2. how to set score increse in opengl
    By Sunder Sha in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-18-2009, 06:44 AM
  3. How to display score
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-16-2002, 05:57 AM
  4. displaying numbers
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-13-2001, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean