#include "tcltk.h" //#include "tkinventor.h" #include "tkglut.h" #include int r=0,g=0,b=0; int blue(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { r=0;g=0;b=1; glutPostRedisplay(); return TCL_OK; } int red(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { r=1,g=0;b=0; glutPostRedisplay(); return TCL_OK; } void myDisplay() { glClearColor(r,g,b,1); glClear(GL_COLOR_BUFFER_BIT); glFinish(); } /*************************************************************************** M A I N ***************************************************************************/ main(int, char **argv) { // Open a glut window glutCreateWindow("Test Window"); // Set up a glut display routine glutDisplayFunc(myDisplay); // Initialize tcl/tk tcltk_init("FOO","FOO","exglut.tcl"); // Turn on tk events within inventors event queue tkglut_on(); // Create some custom tcl commands for our application Tcl_CreateCommand(tclInterp, "red", red, NULL, (void (*)(void *)) NULL); Tcl_CreateCommand(tclInterp, "blue", blue, NULL, (void (*)(void *)) NULL); // Enable tcl command line //tcltk_enableTtyInput(); // Start the glut main loop glutMainLoop(); }