22 #include <QMouseEvent> 23 #include <QOpenGLContext> 24 #include <QOpenGLFunctions> 32 QGLWidget(parent), m_objMutex(QMutex::NonRecursive), m_objGLShaderArray(blnColor)
34 setAttribute(Qt::WA_OpaquePaintEvent);
88 qDebug(
"TVScreen::resizeTVScreen: cols: %d, rows: %d", intCols, intRows);
105 QOpenGLContext *objGlCurrentContext = QOpenGLContext::currentContext();
107 if (objGlCurrentContext)
109 if (QOpenGLContext::currentContext()->isValid())
111 qDebug() <<
"TVScreen::initializeGL: context:" 112 <<
" major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
113 <<
" minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
114 <<
" ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ?
"yes" :
"no");
118 qDebug() <<
"TVScreen::initializeGL: current context is invalid";
123 qCritical() <<
"TVScreen::initializeGL: no current context";
127 QSurface *objSurface = objGlCurrentContext->surface();
129 if (objSurface == NULL)
131 qCritical() <<
"TVScreen::initializeGL: no surface attached";
136 if (objSurface->surfaceType() != QSurface::OpenGLSurface)
138 qCritical() <<
"TVScreen::initializeGL: surface is not an OpenGLSurface: " 139 << objSurface->surfaceType()
140 <<
" cannot use an OpenGL context";
145 qDebug() <<
"TVScreen::initializeGL: OpenGL surface:" 146 <<
" class: " << (objSurface->surfaceClass() == QSurface::Window ?
"Window" :
"Offscreen");
150 connect(objGlCurrentContext, &QOpenGLContext::aboutToBeDestroyed,
this,
160 QOpenGLFunctions *ptrF = QOpenGLContext::currentContext()->functions();
161 ptrF->glViewport(0, 0, intWidth, intHeight);
198 qDebug() <<
"TVScreen::connectTimer";
200 connect(&objTimer, SIGNAL(timeout()),
this, SLOT(
tick()));
bool setDataColor(int intCol, int intRed, int intGreen, int intBlue)
QRgb * getRowBuffer(int intRow)
void connectTimer(const QTimer &timer)
void renderImage(unsigned char *objData)
unsigned char * m_chrLastData
QRgb * GetRowBuffer(int intRow)
bool SelectRow(int intLine)
bool m_blnGLContextInitialized
void getSize(int &intCols, int &intRows) const
void RenderPixels(unsigned char *chrData)
bool SetDataColor(int intCol, QRgb objColor)
void resizeTVScreen(int intCols, int intRows)
void InitializeGL(int intCols, int intRows)
void setColor(bool blnColor)
GLShaderTVArray m_objGLShaderArray
TVScreen(bool blnColor, QWidget *parent=0)
void setColor(bool blnColor)
void resizeGL(int width, int height)
bool selectRow(int intLine)
void mousePressEvent(QMouseEvent *)