22 "uniform highp mat4 uMatrix;\n" 23 "attribute highp vec4 vertex;\n" 24 "attribute highp vec2 texCoord;\n" 25 "varying mediump vec2 texCoordVar;\n" 27 " gl_Position = uMatrix * vertex;\n" 28 " texCoordVar = texCoord;\n" 32 "uniform lowp sampler2D uTexture;\n" 33 "varying mediump vec2 texCoordVar;\n" 35 " gl_FragColor = texture2D(uTexture, texCoordVar);\n" 61 QMatrix4x4 objQMatrix;
74 if (!
m_objProgram->addShaderFromSourceCode(QOpenGLShader::Vertex,
77 qDebug() <<
"GLShaderArray::initializeGL: error in vertex shader: " 81 if (!
m_objProgram->addShaderFromSourceCode(QOpenGLShader::Fragment,
85 <<
"GLShaderArray::initializeGL: error in fragment shader: " 93 qDebug() <<
"GLShaderArray::initializeGL: error linking shader: " 113 m_objImage =
new QImage(intCols, intRows, QImage::Format_RGBA8888);
118 m_objTexture->setMinificationFilter(QOpenGLTexture::Linear);
119 m_objTexture->setMagnificationFilter(QOpenGLTexture::Linear);
151 QOpenGLFunctions *ptrF;
154 int intNbVertices = 6;
156 QMatrix4x4 objQMatrix;
158 GLfloat arrVertices[] =
162 { -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f };
164 GLfloat arrTextureCoords[] =
168 { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f };
187 ptrLine = (QRgb *)
m_objImage->scanLine(intJ);
193 *ptrLine = qRgb((
int) (*(chrData+2)), (
int) (*(chrData+1)), (
int) (*chrData));
198 intVal = (int) (*chrData);
199 *ptrLine = qRgb(intVal, intVal, intVal);
209 ptrF = QOpenGLContext::currentContext()->functions();
217 ptrF->glClear(GL_COLOR_BUFFER_BIT);
222 ptrF->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
223 ptrF->glEnable(GL_BLEND);
225 ptrF->glDisable(GL_BLEND);
233 ptrF->glEnableVertexAttribArray(0);
234 ptrF->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, arrVertices);
236 ptrF->glEnableVertexAttribArray(1);
237 ptrF->glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, arrTextureCoords);
239 ptrF->glDrawArrays(GL_TRIANGLES, 0, intNbVertices);
242 ptrF->glDisableVertexAttribArray(0);
243 ptrF->glDisableVertexAttribArray(1);
297 bool blnRslt =
false;
301 if ((intLine <
m_intRows) && (intLine >= 0))
317 bool blnRslt =
false;
QRgb * GetRowBuffer(int intRow)
bool SelectRow(int intLine)
GLShaderTVArray(bool blnColor)
void RenderPixels(unsigned char *chrData)
bool SetDataColor(int intCol, QRgb objColor)
void InitializeGL(int intCols, int intRows)
static const QString m_strVertexShaderSourceArray
static const QString m_strFragmentShaderSourceColored
QOpenGLTexture * m_objTexture
QOpenGLShaderProgram * m_objProgram