This change prevents the qWarning() in QOpenGLFunctions from being
triggered when creating a QOpenGLShaderProgram object without a current
QOpenGLContext. This is a common case especially when the shader program
is a member variable of a class.
It now relies upon the QOpenGLShaderProgram::init() function to resolve
the GL function pointers when the shader program is first used which of
course should be done with an active context.
Change-Id: Ib7dc345593f2a70d72ef8f650151cc90001058ca
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
{
Q_DECLARE_PUBLIC(QOpenGLShaderProgram)
public:
- QOpenGLShaderProgramPrivate(QOpenGLContext *ctx)
+ QOpenGLShaderProgramPrivate()
: programGuard(0)
, linked(false)
, inited(false)
, geometryVertexCount(64)
, geometryInputType(0)
, geometryOutputType(0)
- , glfuncs(new QOpenGLFunctions(ctx))
+ , glfuncs(new QOpenGLFunctions)
{
}
~QOpenGLShaderProgramPrivate();
\sa addShader()
*/
QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent)
- : QObject(*new QOpenGLShaderProgramPrivate(QOpenGLContext::currentContext()), parent)
+ : QObject(*new QOpenGLShaderProgramPrivate, parent)
{
}