小编Bri*_*rog的帖子

OpenGL Tessellation回调未执行

我使用这里的示例将我的曲面细分回调移动到另一个类.

代码编译,但回调代码永远不会执行.

回调类:

template <class Class, typename ReturnType, typename Parameter>
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_->*method_)(parameter);
    }

    ReturnType execute(Parameter parameter)
    {
        return operator()(parameter);
    }

private:

    Class* class_instance_;
    Method method_;
};
Run Code Online (Sandbox Code Playgroud)

回调:

void MyClass::tessBegin(GLenum which)
{
    glBegin(which);
    cout << "BEGIN CALLBACK IS WORKING";
}

void MyClass::tessVertex(const GLvoid *data)
{
    // cast back to double type
    const GLdouble *ptr = (const GLdouble*)data;

    glVertex3dv(ptr);
    cout << …
Run Code Online (Sandbox Code Playgroud)

c++ opengl callback tessellation

5
推荐指数
1
解决办法
582
查看次数

标签 统计

c++ ×1

callback ×1

opengl ×1

tessellation ×1