Anormal end of program?

Hello,
I made a simple program which open an OpenGL window and draw some shapes inside.
I can quit my application by pressing ‘echap’ key or by clicking on the little cross on the top left hand corner of my window.
If I press ‘echap’, all is OK.
If I click on the cross, 2 lines are written in my console:
Vertex3f: 1
Normal3f: 1

I just don’t know why !!!
Can somebody tell me why ?
(I’ve got a Linux OS)

Thanks.

more information, please…are you using xlib or glut? can you post the code?

I use GLUT.
Here’s some parts of the code:

// keyboard callback function:
GLvoid callback_keyboard(unsigned char key, int x, int y){

switch(key){
// La touche “Echap” permet de sortir du programme

case KEY_ESC:

exit(1);

break;

}

// main function:
int main(int argc, char *argv[])

{

// Initialisation de paramètres de Glut

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT);

glutInitWindowPosition(0, 0);

glutCreateWindow("demo_route");

initGL(); 			// Intitialisation d'OpenGL

initialise_scene(); // Initialisation de la scène

// Appels aux fonctions de call-back

glutDisplayFunc(&callback_display);

glutReshapeFunc(&callback_reshape);

glutKeyboardFunc(&callback_keyboard);

glutSpecialFunc(&callback_special);

glutMouseFunc(&callback_mouse);

glutMotionFunc(&callback_motion);

glutIdleFunc(&callback_idle);

glutMainLoop(); // Boucle principale de Glut

return 1;

}


My progam runs correctly, it’s just that I don’t know why there is those 2 lines in my console at the end of the execution.

in linux there are functions (atexit, on_exit) with which you can register own functions which are called when you exit the program. maybe glut registers a function which gives the output to the console. you can check this by adding

printf(" exiting…
");

in your code before the exit call.

if you see

exiting…
Vertex3f: 1
Normal3f: 1

then, it’s probably like i said.

have you tried exit(0) instead of exit(1)?

from main() you should return 0 if there wasn’t any errors. Returning non zero means there were errors.

As so, exit (0) means exits the program that encounter no errors. And exit (1) means exit the program that encounter errors.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.