[Interest] Usage of QAbstractOpenGLFunctions and derived classes

Thiago Macieira thiago.macieira at intel.com
Tue Dec 17 10:21:14 CET 2013


On terça-feira, 17 de dezembro de 2013 09:49:48, Yves Bailly wrote:
> (1)
> When I try to build this program, I get a link error:
> gl_widget.obj : error LNK2019: symbole externe non résolu "protected: bool
> __cdecl QAbstractOpenGLFunctions::isInitialized(void)const "
> (?isInitialized at QAbstractOpenGLFunctions@@IEBA_NXZ) référencé dans la
> fonction "protected: virtual void __cdecl Gl_Widget::initializeGL(void)"
> (?initializeGL at Gl_Widget@@MEAAXXZ)
> 
> ...which basically says the external symbol
> QAbstractOpenGLFunctions::isInitialized() could not be resolved.
> If I remove the "if" line, thus not calling isInitialized(), everything
> works fine. I even tried to force name resolution with "if (not
> this->QOpenGLFunctions_3_3_Core::isInitialized())", but no luck.
> 
> Any idea about what can go wrong?

Yes: you're calling a function that is not public. Stop calling 
isInitialized().

> To alleviate those points, I tried something like this (with various
> variations and more sanity checks): 

> class My_Class: public
> Some_Other_Super, protected QOpenGLFunctions_3_3_Core {
>    void some_init_method()
>    {
>      QOpenGLContext* ctx = QOpenGLContext::currentContext();
>      QOpenGLFunctions_3_3_Core* funcs =
> ctx->versionFunctions<QOpenGLFunctions_3_3_Core>();
> dynamic_cast<QOpenGLFunctions_3_3_Core&>(*this) = *funcs;
>    }
> }

Why are you trying to initialize like that? You should simply call 
initializeOpenGLFunctions().

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131217/e12d6d91/attachment.sig>


More information about the Interest mailing list