Why I can't use original OpenGLES functions directly?

  • I generally understand the rationale behind QOpenGLFunctions and QOpenGLExtraFunctions objects,but in reality those make it pretty hard to work with external OpenGL code base.From what I understood one should include those headers ,or extend QOpenGLWidget with one of them to get access to GL functions.The second option is preferable if one doesn't want to write code like this:


    But it doesn't really help me if I put into Qt a code base with many classes that internally call pure GL methods,because in this case I must either extend all those classes with QOpenGLFunctions ,or rewrite them to be called as members of that class.Both are unacceptable if the code base is a lib ,which maybe used also outside Qt SDK.So what do I do? in this case? How I call the GLES functions directly and independently of QOpenGLFunctions? I tried to include GLES2 and GLES3 headers directly in the app but it brings alot of header conflicts and unresolved external symbols errors,which leads me to think that Qt (ANGLE) by default doesn't use those headers declaration.IS it true?When then do you expose them? So,I am quite disappointed by the fact that latest Qt forces us to use QOpenGLFunctions wrappers and allows no easy way to just use pure GL methods.

  • Lifetime Qt Champion


    Do you mean like in the Cube OpenGL ES 2.0 example ?

  • @SGaist Yeah,I don't want to use Qt's GL wrappers.So indeed I started with that sample to see how they do it.So it sucks.I can't use gl methods directly.Moreover,in some blog post Qt guy says it is completely ok to use GLES3 headers directly,but it just doesn't work.
    So what do I do in this case?
    Should I build the Qt with no GL at all and add ANGLE manually?

  • Lifetime Qt Champion

  • That's exactly the blog post I am referring to.So what he says is not correct for the latest Qt version.Including GLES headers directly causes headers collisions and linker errors.

  • Lifetime Qt Champion

    The only time the direct inclusion is mentioned is at the end and concerns only Android.

  • "While nothing stops the developer from using these APIs directly (that is, #include <GLES3/gl3.h>, call the functions directly, and be done with it), the cross-platform development story used to be less than ideal, leading to compile and run-time checks scattered across the application"
    At the header of the blogpost.So you say it relates to mobile dev only?

  • Lifetime Qt Champion

    Go down to the "Summary" and "Bonus problem: the headers" part of the post which is likely what you are interested about.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.