Introducing QOpenGLShaderProgram::create()

Needed for QOpenGLShaderProgram to be usable with
GL_OES_get_program_binary and potentially other extensions.

[Changelog][QtGui] The function QOpenGLShaderProgram::create()
has been added. It is can be used to force immediate allocation
of the program's id.

Change-Id: I36b3f45b00e7a439df12c54af7dc06c0ba913587
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Gunnar Sletta 2014-02-11 12:53:36 +01:00 committed by The Qt Project
parent 26a5727f75
commit 12a7d23d52
2 changed files with 24 additions and 1 deletions

View File

@ -123,7 +123,8 @@ QT_BEGIN_NAMESPACE
on the return value from programId(). Then the application should on the return value from programId(). Then the application should
call link(), which will notice that the program has already been call link(), which will notice that the program has already been
specified and linked, allowing other operations to be performed specified and linked, allowing other operations to be performed
on the shader program. on the shader program. The shader program's id can be explicitly
created using the create() function.
\sa QOpenGLShader \sa QOpenGLShader
*/ */
@ -639,6 +640,26 @@ QOpenGLShaderProgram::~QOpenGLShaderProgram()
{ {
} }
/*!
Requests the shader program's id to be created immediately. Returns \c true
if successful; \c false otherwise.
This function is primarily useful when combining QOpenGLShaderProgram
with other OpenGL functions that operate directly on the shader
program id, like \c {GL_OES_get_program_binary}.
When the shader program is used normally, the shader program's id will
be created on demand.
\sa programId()
\since 5.3
*/
bool QOpenGLShaderProgram::create()
{
return init();
}
bool QOpenGLShaderProgram::init() bool QOpenGLShaderProgram::init()
{ {
Q_D(QOpenGLShaderProgram); Q_D(QOpenGLShaderProgram);

View File

@ -130,6 +130,8 @@ public:
bool bind(); bool bind();
void release(); void release();
bool create();
GLuint programId() const; GLuint programId() const;
int maxGeometryOutputVertices() const; int maxGeometryOutputVertices() const;