void keyboard (unsigned char key, int x, int y) {
if (key==27) {exit (0);}
else if (key==60){d=0}
else if (key==62){d=1}
}
Then i call that function in the glutKeyboardFunc.
the problem is that d doesnt keep the value asigned by the keyboard function. but the one define in the begining!
some idea?
thx!
Yet another noob prolem!!!
im not sure if this thread belongs here but let`s try ;)
i have this code
i declare d at the begining
#include <fstream>char FTLoad[256]="/mnt/backup/mdv/OpenGL/textura/panel.bmp";int d=0;using namespace std;void keyboard (unsigned char key, int x, int y) {if (key==27) {/*exit (0)*/d=1;}else if (key==60){d=0;}else if (key==62){d=1;}}//here comes more crapint main (int argc, char **argv) {glutKeyboardFunc(keyboard) //here comes more crap}
So you push '2' and d doesn't change to 1? Maybe you should slip in a printf("%c pushed, d is %d\n",key,d); at the end of your function for debugging. It will let you see if d is really getting changed. Perhaps it's getting reset elsewhere?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement