iDevGames Forums
Functions not being initialised onKeyDown - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Functions not being initialised onKeyDown (/thread-10998.html)



Functions not being initialised onKeyDown - Yendall - Apr 14, 2014 04:59 PM

Hey everyone,

Sorry if this has been answered before. For some reason my functions aren't being initialised properly in my switch statement within glutKeyboardFunc. I have debugged glutKeyboardFunc to see if it is initialising my keyDown, and it is.

Here is my code:
Code:
void keyDown(unsigned char key, int x, int y)
{
  switch(key)
  {
   /*Switch to filled mode or line mode*/
    case 'o':
      drawXYZ();
      drawn = !drawn;
      break;
    case 'n':
      printf("N pressed\n");
      drawNormals();
      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      break;
    default:
      break;

  }
}

These functions are located above keyDown() in terms of layout. I assume this is happening because of placement of the functions themself.

[Image: QVJdXcW.jpg]

Thanks for any help


RE: Functions not being initialised onKeyDown - OneSadCookie - Apr 15, 2014 01:31 PM

From your console log, it’s clear this function is in fact being called, so what exactly is the problem?