[Interest] Usage of QAbstractOpenGLFunctions and derived classes

Yves Bailly yves.bailly at sescoi.fr
Wed Dec 18 08:32:21 CET 2013


Le 17/12/2013 17:58, Thiago Macieira a écrit :
> On terça-feira, 17 de dezembro de 2013 11:56:58, Yves Bailly wrote:
>> It is protected, so "public" for any derived class... if it's not
>> intended to be used at all, then maybe it might be better to remove
>> it entirely?
>
> It's used by derived classes. These classes:

I know this. But it's visible in the public API as any protected method, it
even appears in the doc 
(https://qt-project.org/doc/qt-5/qabstractopenglfunctions.html#isInitialized), which is where I saw 
it the
first time.

So if it should not be used by users, at least it should be hidden in
the doc or with a notice added such as "for internal use only, don't use".

However this discussion about this method doesn't answer at all about the
overall usability of those QOpenGLFunctions_* classes. To be clear, I really
like the idea - indeed having a compile error when trying to use a
deprecated function is way better than random runtime crashes. But having to
move around everywhere some kind of pointer and call all the OpenGL functions
by prefixing them with "my_pointer_on_gl_funcs->" is a real burden.

This could be solved just by making QOpenGLFunctions_* classes more like
implicitly-shared classes (QImage, QString, QVector<>, etc.) : then one could
subclass from it and initialize function pointers by copy-constructor or
operator=. Internally only a shared pointer would be copied, functions resolving
done only once, and no more annoying prefix to call functions.

Don't you think it would make them more pleasant to use? at least in the
context of a heavy OpenGL, (tens of) thousands of OpenGL calls involved.

Regards,

-- 
      /- Yves Bailly - Software developer   -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."



More information about the Interest mailing list