Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.85 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Using GLUT in an Object Oriented Program
  2. #ifndef MCVIEWER_H__
  3. #define MCVIEWER_H__
  4.  
  5. #include <cstdlib>
  6. #include <ctime>
  7. #include <stdlib.h>
  8. #include <string>
  9. #include <math.h>
  10. #include <iostream>
  11. #include <assert.h>
  12. #include <GLUT/GLUT.h>
  13.  
  14. class MCViewer {
  15.     //MCViewer declarations, implementation specified in corresponding .cpp
  16. };
  17.  
  18. extern MCViewer *currRef;
  19.  
  20. extern "C" {    
  21.     static void displayFcnCB(void) {
  22.         currRef->displayFcn();
  23.     }
  24.  
  25.     static void winReshapeFcnCB(GLint newWidth, GLint newHeight) {
  26.         currRef->winReshapeFcn(newWidth, newHeight);
  27.     }
  28.  
  29.     static void keyboardActionCB(GLubyte key, GLint xMouse, GLint yMouse) {
  30.         currRef->keyboardAction(key, xMouse, yMouse);
  31.     }
  32. }
  33.  
  34. #endif //MCVIEWER_H__
  35.        
  36. extern MCViewer *currRef;
  37.  
  38. extern "C" {    
  39.     static void displayFcnCB(void) {
  40.         currRef->displayFcn();
  41.     }