Menu

#211 Popup menu invoke error at certain situation.

open
nobody
None
5
2014-10-17
2014-10-06
Hajin
No

I was using menu with latest stable version of freeglut, and got some error.

What I wanted to do is to enter a value when an Entry of menu is selected, but I got stucked when I input a value.

This problem doesn't appear when I use glut. Thank you.

Discussion

  • Diederick C. Niehorster

    Hi Hajin,

    Thanks for reporting. Can you be more specific? What gets stuck? The menu doesn't close, or input on the console cannot be entered? If you could attach an as small as possible example code that shows the problem would be great too.

    Best,
    Dee

     
  • Hajin

    Hajin - 2014-10-16

    Below is attaching menu.

    glutCreateMenu( Menu );
    glutAddMenuEntry("Reset", 1);
    glutAddMenuEntry("Rotation", 2);
    glutAttachMenu( GLUT_RIGHT_BUTTON );

    and when I select rotation,

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glPushMatrix();
    switch(value) {
    case 1:
    break;
    case 2: // Rotation
    int degree;
    cin >> degree;

    glTranslatef(CM().x, CM().y, 0);
    glRotatef(degree, 0, 0, 1);
    glTranslatef(-CM().x, -CM().y, 0);
    
    glGetDoublev(GL_MODELVIEW_MATRIX, temp_matrix);
    applyMatrix(temp_matrix);
    
    glLoadIdentity();
    
    break;
    

    }
    glGetDoublev(GL_MODELVIEW_MATRIX, temp_matrix);
    glPopMatrix();
    glutPostRedisplay();

    I can enter value but after that,
    the menu doesn't disappear and computer not responding.
    I've tried with glut 3.7.6 and got no error.

     
  • Diederick C. Niehorster

    Hi Hajin,

    Thanks for the example and clearer description. We are about to release a new version of freeglut, would you be willing to test beforehand? A lot has been done on the menu code (it had quite a few issues) and menus now close before the callback is executed. That means, before the code you posted is executed, the menu is already closed. I hope that it won't get stuck now. You can download here: https://sourceforge.net/p/freeglut/code/HEAD/tarball

    Best and thanks,
    Dee

     
  • Hajin

    Hajin - 2014-10-17

    It works!
    When can I get that new version?

    Thank you for your kind answer!

     
  • Diederick C. Niehorster

    Thanks for testing! I find it hard to estimate, but if we don't find any major problems in testing, it should be out within a month. A release candidate is just around the corner, maybe a week or so.

    Best,
    Dee

     

Log in to post a comment.