title: OpenGL Tessellation Callback Not Executing
body: <p>I used the examples <a href="http://www.partow.net/programming/templatecallback/">here</a> to move my tessellation callbacks to a different class.</p>
  
  <p>The code compiles, but the callback code never executes.</p>
  
  <p>Callback Class:</p>
  
  <pre><code>template &lt;class Class, typename ReturnType, typename Parameter&gt;
  class SingularCallBack
  {
  public:
  
      typedef ReturnType (Class::*Method)(Parameter);
  
      SingularCallBack(Class* class_instance, Method method)
          : class_instance_(class_instance),
          method_(method)
      {}
  
      ReturnType operator()(Parameter parameter)
      {
          return (class_instance_-&gt;*method_)(parameter);
      }
  
      ReturnType execute(Parameter parameter)
      {
          return operator()(parameter);
      }
  
  private:
  
      Class* class_instance_;
      Method method_;
  };
  </code></pre>
  
  <p>Callbacks:</p>
  
  <pre><code>void MyClass::tessBegin(GLenum which)
  {
      glBegin(which);
      cout &lt;&lt; "BEGIN CALLBACK IS WORKING";
  }
  
  void MyClass::tessVertex(const GLvoid *data)
  {
      // cast back to double type
      const GLdouble *ptr = (const GLdouble*)data;
  
      glVertex3dv(ptr);
      cout &lt;&lt; "VERTEX CALLBACK IS WORKING";
  }
  </code></pre>
  
  <p>Tessellation function where I'm registering them:</p>
  
  <pre><code>int MyClass::TessellatePolys()
  {
      GLUtesselator *tess = gluNewTess(); // create a tessellator
      if(!tess) return 0;  // failed to create tessellation object, return 0
  
      // register callback functions
      SingularCallBack&lt;GLOrtho, void, GLenum&gt;*BeginCallback;
      BeginCallback = new SingularCallBack&lt;GLOrtho, void, GLenum&gt;(this,&amp;GLOrtho::tessBegin);
      gluTessCallback(tess, GLU_TESS_BEGIN, (void (CALLBACK *)())BeginCallback);
  
      SingularCallBack&lt;GLOrtho, void, const GLvoid*&gt;*VertexCallback;
      VertexCallback = new SingularCallBack&lt;GLOrtho, void, const GLvoid*&gt;(this,&amp;GLOrtho::tessVertex);
      gluTessCallback(tess, GLU_TESS_VERTEX, (void (CALLBACK *)())VertexCallback);
  
      ... (do tessellation) ...
  
      return id;
  }
  </code></pre>
  
  <p>What is wrong with the way the callbacks are being registered?</p>