diff --git a/sdrgui/gui/glshadersimple.cpp b/sdrgui/gui/glshadersimple.cpp index f52c245da..6905682fd 100644 --- a/sdrgui/gui/glshadersimple.cpp +++ b/sdrgui/gui/glshadersimple.cpp @@ -26,22 +26,22 @@ #include "gui/glshadersimple.h" GLShaderSimple::GLShaderSimple() : - m_program(nullptr), + m_program(nullptr), m_vao(nullptr), m_verticesBuf(nullptr), m_vertexLoc(0), m_matrixLoc(0), - m_colorLoc(0) + m_colorLoc(0) { } GLShaderSimple::~GLShaderSimple() { - cleanup(); + cleanup(); } void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) { - m_program = new QOpenGLShaderProgram; + m_program = new QOpenGLShaderProgram; if ((majorVersion > 3) || ((majorVersion == 3) && (minorVersion >= 3))) { @@ -66,16 +66,16 @@ void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) } } - m_program->bindAttributeLocation("vertex", 0); + m_program->bindAttributeLocation("vertex", 0); - if (!m_program->link()) { - qDebug() << "GLShaderSimple::initializeGL: error linking shader: " << m_program->log(); - } + if (!m_program->link()) { + qDebug() << "GLShaderSimple::initializeGL: error linking shader: " << m_program->log(); + } - m_program->bind(); + m_program->bind(); m_vertexLoc = m_program->attributeLocation("vertex"); - m_matrixLoc = m_program->uniformLocation("uMatrix"); - m_colorLoc = m_program->uniformLocation("uColour"); + m_matrixLoc = m_program->uniformLocation("uMatrix"); + m_colorLoc = m_program->uniformLocation("uColour"); if (m_vao) { m_verticesBuf = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); @@ -83,7 +83,7 @@ void GLShaderSimple::initializeGL(int majorVersion, int minorVersion) m_verticesBuf->create(); m_vao->release(); } - m_program->release(); + m_program->release(); } void GLShaderSimple::drawPoints(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) @@ -93,30 +93,30 @@ void GLShaderSimple::drawPoints(const QMatrix4x4& transformMatrix, const QVector void GLShaderSimple::drawPolyline(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) { - draw(GL_LINE_STRIP, transformMatrix, color, vertices, nbVertices, nbComponents); + draw(GL_LINE_STRIP, transformMatrix, color, vertices, nbVertices, nbComponents); } void GLShaderSimple::drawSegments(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) { - draw(GL_LINES, transformMatrix, color, vertices, nbVertices, nbComponents); + draw(GL_LINES, transformMatrix, color, vertices, nbVertices, nbComponents); } void GLShaderSimple::drawContour(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) { - draw(GL_LINE_LOOP, transformMatrix, color, vertices, nbVertices, nbComponents); + draw(GL_LINE_LOOP, transformMatrix, color, vertices, nbVertices, nbComponents); } void GLShaderSimple::drawSurface(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) { - draw(GL_TRIANGLE_FAN, transformMatrix, color, vertices, nbVertices, nbComponents); + draw(GL_TRIANGLE_FAN, transformMatrix, color, vertices, nbVertices, nbComponents); } void GLShaderSimple::draw(unsigned int mode, const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents) { - QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); - m_program->bind(); - m_program->setUniformValue(m_matrixLoc, transformMatrix); - m_program->setUniformValue(m_colorLoc, color); + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); + m_program->bind(); + m_program->setUniformValue(m_matrixLoc, transformMatrix); + m_program->setUniformValue(m_colorLoc, color); if (m_vao) { m_vao->bind(); @@ -128,21 +128,21 @@ void GLShaderSimple::draw(unsigned int mode, const QMatrix4x4& transformMatrix, } else { - f->glEnableVertexAttribArray(m_vertexLoc); // vertex - f->glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); + f->glEnableVertexAttribArray(m_vertexLoc); // vertex + f->glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); } - f->glEnable(GL_BLEND); - f->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - f->glLineWidth(1.0f); - f->glDrawArrays(mode, 0, nbVertices); + f->glEnable(GL_BLEND); + f->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + f->glLineWidth(1.0f); + f->glDrawArrays(mode, 0, nbVertices); if (m_vao) { m_vao->release(); } else { - f->glDisableVertexAttribArray(m_vertexLoc); + f->glDisableVertexAttribArray(m_vertexLoc); } - m_program->release(); + m_program->release(); } void GLShaderSimple::cleanup() @@ -156,34 +156,34 @@ void GLShaderSimple::cleanup() } const QString GLShaderSimple::m_vertexShaderSourceSimple2 = QString( - "uniform highp mat4 uMatrix;\n" - "attribute highp vec4 vertex;\n" - "void main() {\n" - " gl_Position = uMatrix * vertex;\n" - "}\n" - ); + "uniform highp mat4 uMatrix;\n" + "attribute highp vec4 vertex;\n" + "void main() {\n" + " gl_Position = uMatrix * vertex;\n" + "}\n" + ); const QString GLShaderSimple::m_vertexShaderSourceSimple = QString( "#version 330\n" - "uniform highp mat4 uMatrix;\n" - "in highp vec4 vertex;\n" - "void main() {\n" - " gl_Position = uMatrix * vertex;\n" - "}\n" - ); + "uniform highp mat4 uMatrix;\n" + "in highp vec4 vertex;\n" + "void main() {\n" + " gl_Position = uMatrix * vertex;\n" + "}\n" + ); const QString GLShaderSimple::m_fragmentShaderSourceColored2 = QString( - "uniform mediump vec4 uColour;\n" - "void main() {\n" - " gl_FragColor = uColour;\n" - "}\n" - ); + "uniform mediump vec4 uColour;\n" + "void main() {\n" + " gl_FragColor = uColour;\n" + "}\n" + ); const QString GLShaderSimple::m_fragmentShaderSourceColored = QString( "#version 330\n" "out vec4 fragColor;\n" - "uniform mediump vec4 uColour;\n" - "void main() {\n" - " fragColor = uColour;\n" - "}\n" - ); + "uniform mediump vec4 uColour;\n" + "void main() {\n" + " fragColor = uColour;\n" + "}\n" + ); diff --git a/sdrgui/gui/glshadertextured.cpp b/sdrgui/gui/glshadertextured.cpp index b9e2a4db0..07fc43a8c 100644 --- a/sdrgui/gui/glshadertextured.cpp +++ b/sdrgui/gui/glshadertextured.cpp @@ -27,22 +27,22 @@ #include "gui/glshadertextured.h" GLShaderTextured::GLShaderTextured() : - m_program(nullptr), + m_program(nullptr), m_vao(nullptr), m_verticesBuf(nullptr), m_textureCoordsBuf(nullptr), - m_texture(nullptr), + m_texture(nullptr), m_textureId(0), m_vertexLoc(0), m_texCoordLoc(0), - m_matrixLoc(0), - m_textureLoc(0), + m_matrixLoc(0), + m_textureLoc(0), m_useImmutableStorage(true) { } GLShaderTextured::~GLShaderTextured() { - cleanup(); + cleanup(); } void GLShaderTextured::initializeGL(int majorVersion, int minorVersion) @@ -75,18 +75,18 @@ void GLShaderTextured::initializeGL(int majorVersion, int minorVersion) } } - m_program->bindAttributeLocation("vertex", 0); - m_program->bindAttributeLocation("texCoord", 1); + m_program->bindAttributeLocation("vertex", 0); + m_program->bindAttributeLocation("texCoord", 1); - if (!m_program->link()) { - qDebug() << "GLShaderTextured::initializeGL: error linking shader: " << m_program->log(); - } + if (!m_program->link()) { + qDebug() << "GLShaderTextured::initializeGL: error linking shader: " << m_program->log(); + } - m_program->bind(); - m_vertexLoc = m_program->attributeLocation("vertex"); - m_texCoordLoc = m_program->attributeLocation("texCoord"); - m_matrixLoc = m_program->uniformLocation("uMatrix"); - m_textureLoc = m_program->uniformLocation("uTexture"); + m_program->bind(); + m_vertexLoc = m_program->attributeLocation("vertex"); + m_texCoordLoc = m_program->attributeLocation("texCoord"); + m_matrixLoc = m_program->uniformLocation("uMatrix"); + m_textureLoc = m_program->uniformLocation("uTexture"); if (m_vao) { m_verticesBuf = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); @@ -97,7 +97,7 @@ void GLShaderTextured::initializeGL(int majorVersion, int minorVersion) m_textureCoordsBuf->create(); m_vao->release(); } - m_program->release(); + m_program->release(); } void GLShaderTextured::initTexture(const QImage& image, QOpenGLTexture::WrapMode wrapMode) @@ -111,34 +111,34 @@ void GLShaderTextured::initTexture(const QImage& image, QOpenGLTexture::WrapMode void GLShaderTextured::initTextureImmutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode) { - if (m_texture) { - delete m_texture; - } + if (m_texture) { + delete m_texture; + } - m_texture = new QOpenGLTexture(image); + m_texture = new QOpenGLTexture(image); - m_texture->setMinificationFilter(QOpenGLTexture::Linear); - m_texture->setMagnificationFilter(QOpenGLTexture::Linear); - m_texture->setWrapMode(wrapMode); + m_texture->setMinificationFilter(QOpenGLTexture::Linear); + m_texture->setMagnificationFilter(QOpenGLTexture::Linear); + m_texture->setWrapMode(wrapMode); } void GLShaderTextured::initTextureMutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode) { - if (m_textureId) + if (m_textureId) { - glDeleteTextures(1, &m_textureId); - m_textureId = 0; - } + glDeleteTextures(1, &m_textureId); + m_textureId = 0; + } - glGenTextures(1, &m_textureId); - glBindTexture(GL_TEXTURE_2D, m_textureId); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, - image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constScanLine(0)); + glGenTextures(1, &m_textureId); + glBindTexture(GL_TEXTURE_2D, m_textureId); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, + image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constScanLine(0)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapMode); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapMode); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapMode); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapMode); } void GLShaderTextured::subTexture(int xOffset, int yOffset, int width, int height, const void *pixels) @@ -152,33 +152,33 @@ void GLShaderTextured::subTexture(int xOffset, int yOffset, int width, int heigh void GLShaderTextured::subTextureImmutable(int xOffset, int yOffset, int width, int height, const void *pixels) { - if (!m_texture) + if (!m_texture) { - qDebug("GLShaderTextured::subTextureImmutable: no texture defined. Doing nothing"); - return; - } + qDebug("GLShaderTextured::subTextureImmutable: no texture defined. Doing nothing"); + return; + } - QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); - m_texture->bind(); - f->glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); + m_texture->bind(); + f->glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); } void GLShaderTextured::subTextureMutable(int xOffset, int yOffset, int width, int height, const void *pixels) { - if (!m_textureId) + if (!m_textureId) { - qDebug("GLShaderTextured::subTextureMutable: no texture defined. Doing nothing"); - return; - } + qDebug("GLShaderTextured::subTextureMutable: no texture defined. Doing nothing"); + return; + } - glBindTexture(GL_TEXTURE_2D, m_textureId); - glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glBindTexture(GL_TEXTURE_2D, m_textureId); + glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); } void GLShaderTextured::drawSurface(const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents) { if (m_useImmutableStorage) { - draw(GL_TRIANGLE_FAN, transformMatrix, textureCoords, vertices, nbVertices, nbComponents); + draw(GL_TRIANGLE_FAN, transformMatrix, textureCoords, vertices, nbVertices, nbComponents); } else { drawMutable(GL_TRIANGLE_FAN, transformMatrix, textureCoords, vertices, nbVertices, nbComponents); } @@ -186,17 +186,17 @@ void GLShaderTextured::drawSurface(const QMatrix4x4& transformMatrix, GLfloat *t void GLShaderTextured::draw(unsigned int mode, const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents) { - if (!m_texture) + if (!m_texture) { - qDebug("GLShaderTextured::draw: no texture defined. Doing nothing"); - return; - } + qDebug("GLShaderTextured::draw: no texture defined. Doing nothing"); + return; + } - QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); - m_program->bind(); - m_program->setUniformValue(m_matrixLoc, transformMatrix); - m_texture->bind(); - m_program->setUniformValue(m_textureLoc, 0); // Use texture unit 0 which magically contains our texture + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); + m_program->bind(); + m_program->setUniformValue(m_matrixLoc, transformMatrix); + m_texture->bind(); + m_program->setUniformValue(m_textureLoc, 0); // Use texture unit 0 which magically contains our texture if (m_vao) { m_vao->bind(); @@ -213,13 +213,13 @@ void GLShaderTextured::draw(unsigned int mode, const QMatrix4x4& transformMatrix } else { - f->glEnableVertexAttribArray(m_vertexLoc); // vertex - f->glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); - f->glEnableVertexAttribArray(m_texCoordLoc); // texture coordinates - f->glVertexAttribPointer(m_texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, textureCoords); + f->glEnableVertexAttribArray(m_vertexLoc); // vertex + f->glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); + f->glEnableVertexAttribArray(m_texCoordLoc); // texture coordinates + f->glVertexAttribPointer(m_texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, textureCoords); } - f->glDrawArrays(mode, 0, nbVertices); + f->glDrawArrays(mode, 0, nbVertices); if (m_vao) { @@ -227,32 +227,32 @@ void GLShaderTextured::draw(unsigned int mode, const QMatrix4x4& transformMatrix } else { - f->glDisableVertexAttribArray(m_vertexLoc); - f->glDisableVertexAttribArray(m_texCoordLoc); + f->glDisableVertexAttribArray(m_vertexLoc); + f->glDisableVertexAttribArray(m_texCoordLoc); } - m_program->release(); + m_program->release(); } void GLShaderTextured::drawMutable(unsigned int mode, const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents) { - if (!m_textureId) + if (!m_textureId) { - qDebug("GLShaderTextured::drawMutable: no texture defined. Doing nothing"); - return; - } + qDebug("GLShaderTextured::drawMutable: no texture defined. Doing nothing"); + return; + } - m_program->bind(); - m_program->setUniformValue(m_matrixLoc, transformMatrix); - glBindTexture(GL_TEXTURE_2D, m_textureId); - m_program->setUniformValue(m_textureLoc, 0); // Use texture unit 0 which magically contains our texture - glEnableVertexAttribArray(m_vertexLoc); // vertex - glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); - glEnableVertexAttribArray(m_texCoordLoc); // texture coordinates - glVertexAttribPointer(m_texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, textureCoords); - glDrawArrays(mode, 0, nbVertices); - glDisableVertexAttribArray(m_vertexLoc); - glDisableVertexAttribArray(m_texCoordLoc); - m_program->release(); + m_program->bind(); + m_program->setUniformValue(m_matrixLoc, transformMatrix); + glBindTexture(GL_TEXTURE_2D, m_textureId); + m_program->setUniformValue(m_textureLoc, 0); // Use texture unit 0 which magically contains our texture + glEnableVertexAttribArray(m_vertexLoc); // vertex + glVertexAttribPointer(m_vertexLoc, nbComponents, GL_FLOAT, GL_FALSE, 0, vertices); + glEnableVertexAttribArray(m_texCoordLoc); // texture coordinates + glVertexAttribPointer(m_texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, textureCoords); + glDrawArrays(mode, 0, nbVertices); + glDisableVertexAttribArray(m_vertexLoc); + glDisableVertexAttribArray(m_texCoordLoc); + m_program->release(); } void GLShaderTextured::cleanup() @@ -268,9 +268,9 @@ void GLShaderTextured::cleanup() delete m_texture; m_texture = nullptr; - if (!QOpenGLContext::currentContext()) { - return; - } + if (!QOpenGLContext::currentContext()) { + return; + } if (m_textureId) { @@ -307,42 +307,42 @@ bool GLShaderTextured::useImmutableStorage() } const QString GLShaderTextured::m_vertexShaderSourceTextured2 = QString( - "uniform highp mat4 uMatrix;\n" - "attribute highp vec4 vertex;\n" - "attribute highp vec2 texCoord;\n" - "varying mediump vec2 texCoordVar;\n" - "void main() {\n" - " gl_Position = uMatrix * vertex;\n" - " texCoordVar = texCoord;\n" - "}\n" - ); + "uniform highp mat4 uMatrix;\n" + "attribute highp vec4 vertex;\n" + "attribute highp vec2 texCoord;\n" + "varying mediump vec2 texCoordVar;\n" + "void main() {\n" + " gl_Position = uMatrix * vertex;\n" + " texCoordVar = texCoord;\n" + "}\n" + ); const QString GLShaderTextured::m_vertexShaderSourceTextured = QString( "#version 330\n" - "uniform highp mat4 uMatrix;\n" - "in highp vec4 vertex;\n" - "in highp vec2 texCoord;\n" - "out mediump vec2 texCoordVar;\n" - "void main() {\n" - " gl_Position = uMatrix * vertex;\n" - " texCoordVar = texCoord;\n" - "}\n" - ); + "uniform highp mat4 uMatrix;\n" + "in highp vec4 vertex;\n" + "in highp vec2 texCoord;\n" + "out mediump vec2 texCoordVar;\n" + "void main() {\n" + " gl_Position = uMatrix * vertex;\n" + " texCoordVar = texCoord;\n" + "}\n" + ); const QString GLShaderTextured::m_fragmentShaderSourceTextured2 = QString( - "uniform lowp sampler2D uTexture;\n" - "varying mediump vec2 texCoordVar;\n" - "void main() {\n" - " gl_FragColor = texture2D(uTexture, texCoordVar);\n" - "}\n" - ); + "uniform lowp sampler2D uTexture;\n" + "varying mediump vec2 texCoordVar;\n" + "void main() {\n" + " gl_FragColor = texture2D(uTexture, texCoordVar);\n" + "}\n" + ); const QString GLShaderTextured::m_fragmentShaderSourceTextured = QString( "#version 330\n" - "uniform lowp sampler2D uTexture;\n" - "in mediump vec2 texCoordVar;\n" + "uniform lowp sampler2D uTexture;\n" + "in mediump vec2 texCoordVar;\n" "out vec4 fragColor;\n" - "void main() {\n" - " fragColor = texture(uTexture, texCoordVar);\n" - "}\n" - ); + "void main() {\n" + " fragColor = texture(uTexture, texCoordVar);\n" + "}\n" + ); diff --git a/sdrgui/gui/glshadertextured.h b/sdrgui/gui/glshadertextured.h index a92b0d98e..f422716a0 100644 --- a/sdrgui/gui/glshadertextured.h +++ b/sdrgui/gui/glshadertextured.h @@ -37,39 +37,39 @@ class QImage; class SDRGUI_API GLShaderTextured : protected QOpenGLFunctions { public: - GLShaderTextured(); - ~GLShaderTextured(); + GLShaderTextured(); + ~GLShaderTextured(); - void initializeGL(int majorVersion, int minorVersion); - void initTexture(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); - void subTexture(int xOffset, int yOffset, int width, int height, const void *pixels); - void drawSurface(const QMatrix4x4& transformMatrix, GLfloat* textureCoords, GLfloat *vertices, int nbVertices, int nbComponents=2); - void cleanup(); + void initializeGL(int majorVersion, int minorVersion); + void initTexture(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); + void subTexture(int xOffset, int yOffset, int width, int height, const void *pixels); + void drawSurface(const QMatrix4x4& transformMatrix, GLfloat* textureCoords, GLfloat *vertices, int nbVertices, int nbComponents=2); + void cleanup(); private: - void draw(unsigned int mode, const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents); + void draw(unsigned int mode, const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents); void drawMutable(unsigned int mode, const QMatrix4x4& transformMatrix, GLfloat *textureCoords, GLfloat *vertices, int nbVertices, int nbComponents); - void initTextureImmutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); - void subTextureImmutable(int xOffset, int yOffset, int width, int height, const void *pixels); - void initTextureMutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); - void subTextureMutable(int xOffset, int yOffset, int width, int height, const void *pixels); + void initTextureImmutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); + void subTextureImmutable(int xOffset, int yOffset, int width, int height, const void *pixels); + void initTextureMutable(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat); + void subTextureMutable(int xOffset, int yOffset, int width, int height, const void *pixels); bool useImmutableStorage(); - QOpenGLShaderProgram *m_program; + QOpenGLShaderProgram *m_program; QOpenGLVertexArrayObject *m_vao; QOpenGLBuffer *m_verticesBuf; QOpenGLBuffer *m_textureCoordsBuf; - QOpenGLTexture *m_texture; + QOpenGLTexture *m_texture; unsigned int m_textureId; int m_vertexLoc; int m_texCoordLoc; - int m_matrixLoc; - int m_textureLoc; + int m_matrixLoc; + int m_textureLoc; bool m_useImmutableStorage; - static const QString m_vertexShaderSourceTextured2; - static const QString m_vertexShaderSourceTextured; - static const QString m_fragmentShaderSourceTextured2; - static const QString m_fragmentShaderSourceTextured; + static const QString m_vertexShaderSourceTextured2; + static const QString m_vertexShaderSourceTextured; + static const QString m_fragmentShaderSourceTextured2; + static const QString m_fragmentShaderSourceTextured; }; #endif /* INCLUDE_GUI_GLSHADERTEXTURED_H_ */