Recently, Craig was digging through some "old 3D code," intending to chop it up and port it to some foreign language. What he found was some very special code, written by a very special coder; and folks, when you come across something like this, it's a crime against humanity to do anything but put it in a museum.

We are that very special museum. Step up, one and all! On to the exhibition!

 

      /* Now done in CoderSpecial()...
      while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
          {
          if (!GetMessage(&msg, NULL, 0, 0))
              return;
          TranslateMessage(&msg);
          DispatchMessage(&msg);
          }
      */
      CoderSpecial(-98765);

 

What's so special about -98765?

 

  void CoderSpecial (GLenum mode)
      {
      MSG msg;
      static int called98765 = FALSE;
      static DWORD now, lastCheck = 0;

      now = GetTickCount();

      if ((mode == -98765) || (called98765 && (now - lastCheck> 250)))
          {
          lastCheck = now;
          while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
              {
              if (!GetMessage(&msg, NULL, 0, 0))
                  return;
              TranslateMessage(&msg);
              DispatchMessage(&msg);
              }
          }

  #undef glBegin
      if (mode != -98765)
          glBegin(mode);
      else
          called98765 = TRUE;
      }

 

And why the #undef? Because the headers for the module #define glBegin CoderSpecial.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!