mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Use integers for OpenGL version
This commit is contained in:
parent
e13e919012
commit
e31880fc66
@ -156,7 +156,8 @@ void GLScope::newTraces(std::vector<float *> *traces, int traceIndex, std::vecto
|
|||||||
void GLScope::initializeGL()
|
void GLScope::initializeGL()
|
||||||
{
|
{
|
||||||
QOpenGLContext *glCurrentContext = QOpenGLContext::currentContext();
|
QOpenGLContext *glCurrentContext = QOpenGLContext::currentContext();
|
||||||
float openGLVersion = 0.0f;
|
int majorVersion = 0;
|
||||||
|
int minorVersion = 0;
|
||||||
|
|
||||||
if (glCurrentContext)
|
if (glCurrentContext)
|
||||||
{
|
{
|
||||||
@ -166,8 +167,8 @@ void GLScope::initializeGL()
|
|||||||
<< " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
|
<< " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
|
||||||
<< " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
|
<< " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
|
||||||
<< " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
|
<< " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
|
||||||
openGLVersion = (QOpenGLContext::currentContext()->format()).majorVersion()
|
majorVersion = (QOpenGLContext::currentContext()->format()).majorVersion();
|
||||||
+ ((QOpenGLContext::currentContext()->format()).minorVersion() / 10.0);
|
minorVersion = (QOpenGLContext::currentContext()->format()).minorVersion();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -208,14 +209,14 @@ void GLScope::initializeGL()
|
|||||||
glFunctions->initializeOpenGLFunctions();
|
glFunctions->initializeOpenGLFunctions();
|
||||||
|
|
||||||
//glDisable(GL_DEPTH_TEST);
|
//glDisable(GL_DEPTH_TEST);
|
||||||
m_glShaderSimple.initializeGL(openGLVersion);
|
m_glShaderSimple.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderColors.initializeGL(openGLVersion);
|
m_glShaderColors.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderLeft1Scale.initializeGL(openGLVersion);
|
m_glShaderLeft1Scale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderBottom1Scale.initializeGL(openGLVersion);
|
m_glShaderBottom1Scale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderLeft2Scale.initializeGL(openGLVersion);
|
m_glShaderLeft2Scale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderBottom2Scale.initializeGL(openGLVersion);
|
m_glShaderBottom2Scale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderPowerOverlay.initializeGL(openGLVersion);
|
m_glShaderPowerOverlay.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderTextOverlay.initializeGL(openGLVersion);
|
m_glShaderTextOverlay.initializeGL(majorVersion, minorVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScope::resizeGL(int width, int height)
|
void GLScope::resizeGL(int width, int height)
|
||||||
|
@ -36,11 +36,11 @@ GLShaderColors::~GLShaderColors()
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLShaderColors::initializeGL(float openGLVersion)
|
void GLShaderColors::initializeGL(int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
m_program = new QOpenGLShaderProgram;
|
m_program = new QOpenGLShaderProgram;
|
||||||
|
|
||||||
if (openGLVersion >= 3.3)
|
if ((majorVersion > 3) || ((majorVersion == 3) && (minorVersion >= 3)))
|
||||||
{
|
{
|
||||||
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceSimple)) {
|
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceSimple)) {
|
||||||
qDebug() << "GLShaderColors::initializeGL: error in vertex shader: " << m_program->log();
|
qDebug() << "GLShaderColors::initializeGL: error in vertex shader: " << m_program->log();
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
GLShaderColors();
|
GLShaderColors();
|
||||||
~GLShaderColors();
|
~GLShaderColors();
|
||||||
|
|
||||||
void initializeGL(float openGLVersion);
|
void initializeGL(int majorVersion, int minorVersion);
|
||||||
void drawPoints(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
void drawPoints(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
||||||
void drawPolyline(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
void drawPolyline(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
||||||
void drawSegments(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
void drawSegments(const QMatrix4x4& transformMatrix, GLfloat *vertices, GLfloat *colors, GLfloat alpha, int nbVertices);
|
||||||
|
@ -36,11 +36,11 @@ GLShaderSimple::~GLShaderSimple()
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLShaderSimple::initializeGL(float openGLVersion)
|
void GLShaderSimple::initializeGL(int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
m_program = new QOpenGLShaderProgram;
|
m_program = new QOpenGLShaderProgram;
|
||||||
|
|
||||||
if (openGLVersion >= 3.3)
|
if ((majorVersion > 3) || ((majorVersion == 3) && (minorVersion >= 3)))
|
||||||
{
|
{
|
||||||
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceSimple)) {
|
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceSimple)) {
|
||||||
qDebug() << "GLShaderSimple::initializeGL: error in vertex shader: " << m_program->log();
|
qDebug() << "GLShaderSimple::initializeGL: error in vertex shader: " << m_program->log();
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
GLShaderSimple();
|
GLShaderSimple();
|
||||||
~GLShaderSimple();
|
~GLShaderSimple();
|
||||||
|
|
||||||
void initializeGL(float openGLVersion);
|
void initializeGL(int majorVersion, int minorVersion);
|
||||||
void drawPoints(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
void drawPoints(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
||||||
void drawPolyline(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
void drawPolyline(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
||||||
void drawSegments(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
void drawSegments(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
||||||
|
@ -75,13 +75,13 @@ GLShaderSpectrogram::~GLShaderSpectrogram()
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLShaderSpectrogram::initializeGL(float openGLVersion)
|
void GLShaderSpectrogram::initializeGL(int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
m_useImmutableStorage = useImmutableStorage();
|
m_useImmutableStorage = useImmutableStorage();
|
||||||
qDebug() << "GLShaderSpectrogram::initializeGL: m_useImmutableStorage: " << m_useImmutableStorage;
|
qDebug() << "GLShaderSpectrogram::initializeGL: m_useImmutableStorage: " << m_useImmutableStorage;
|
||||||
|
|
||||||
if (openGLVersion >= 3.3)
|
if ((majorVersion > 3) || ((majorVersion == 3) && (minorVersion >= 3)))
|
||||||
{
|
{
|
||||||
m_programShaded = new QOpenGLShaderProgram;
|
m_programShaded = new QOpenGLShaderProgram;
|
||||||
if (!m_programShaded->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShader)) {
|
if (!m_programShaded->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShader)) {
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
GLShaderSpectrogram();
|
GLShaderSpectrogram();
|
||||||
~GLShaderSpectrogram();
|
~GLShaderSpectrogram();
|
||||||
|
|
||||||
void initializeGL(float openGLVersion);
|
void initializeGL(int majorVersion, int minorVersion);
|
||||||
void initColorMapTexture(const QString &colorMapName);
|
void initColorMapTexture(const QString &colorMapName);
|
||||||
void initTexture(const QImage& image);
|
void initTexture(const QImage& image);
|
||||||
void subTexture(int xOffset, int yOffset, int width, int height, const void *pixels);
|
void subTexture(int xOffset, int yOffset, int width, int height, const void *pixels);
|
||||||
|
@ -40,14 +40,14 @@ GLShaderTextured::~GLShaderTextured()
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLShaderTextured::initializeGL(float openGLVersion)
|
void GLShaderTextured::initializeGL(int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
m_useImmutableStorage = useImmutableStorage();
|
m_useImmutableStorage = useImmutableStorage();
|
||||||
qDebug() << "GLShaderTextured::initializeGL: m_useImmutableStorage: " << m_useImmutableStorage;
|
qDebug() << "GLShaderTextured::initializeGL: m_useImmutableStorage: " << m_useImmutableStorage;
|
||||||
|
|
||||||
m_program = new QOpenGLShaderProgram;
|
m_program = new QOpenGLShaderProgram;
|
||||||
if (openGLVersion >= 3.3f)
|
if ((majorVersion > 3) || ((majorVersion == 3) && (minorVersion >= 3)))
|
||||||
{
|
{
|
||||||
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceTextured)) {
|
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, m_vertexShaderSourceTextured)) {
|
||||||
qDebug() << "GLShaderTextured::initializeGL: error in vertex shader: " << m_program->log();
|
qDebug() << "GLShaderTextured::initializeGL: error in vertex shader: " << m_program->log();
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
GLShaderTextured();
|
GLShaderTextured();
|
||||||
~GLShaderTextured();
|
~GLShaderTextured();
|
||||||
|
|
||||||
void initializeGL(float openGLVersion);
|
void initializeGL(int majorVersion, int minorVersion);
|
||||||
void initTexture(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat);
|
void initTexture(const QImage& image, QOpenGLTexture::WrapMode wrapMode = QOpenGLTexture::Repeat);
|
||||||
void subTexture(int xOffset, int yOffset, int width, int height, const void *pixels);
|
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 drawSurface(const QMatrix4x4& transformMatrix, GLfloat* textureCoords, GLfloat *vertices, int nbVertices, int nbComponents=2);
|
||||||
|
@ -766,7 +766,8 @@ void GLSpectrum::updateHistogram(const Real *spectrum)
|
|||||||
void GLSpectrum::initializeGL()
|
void GLSpectrum::initializeGL()
|
||||||
{
|
{
|
||||||
QOpenGLContext *glCurrentContext = QOpenGLContext::currentContext();
|
QOpenGLContext *glCurrentContext = QOpenGLContext::currentContext();
|
||||||
float openGLVersion = 0.0f;
|
int majorVersion = 0;
|
||||||
|
int minorVersion = 0;
|
||||||
|
|
||||||
if (glCurrentContext)
|
if (glCurrentContext)
|
||||||
{
|
{
|
||||||
@ -776,8 +777,8 @@ void GLSpectrum::initializeGL()
|
|||||||
<< " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
|
<< " major: " << (QOpenGLContext::currentContext()->format()).majorVersion()
|
||||||
<< " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
|
<< " minor: " << (QOpenGLContext::currentContext()->format()).minorVersion()
|
||||||
<< " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
|
<< " ES: " << (QOpenGLContext::currentContext()->isOpenGLES() ? "yes" : "no");
|
||||||
openGLVersion = (QOpenGLContext::currentContext()->format()).majorVersion()
|
majorVersion = (QOpenGLContext::currentContext()->format()).majorVersion();
|
||||||
+ ((QOpenGLContext::currentContext()->format()).minorVersion() / 10.0);
|
minorVersion = (QOpenGLContext::currentContext()->format()).minorVersion();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug() << "GLSpectrum::initializeGL: current context is invalid";
|
qDebug() << "GLSpectrum::initializeGL: current context is invalid";
|
||||||
@ -816,16 +817,16 @@ void GLSpectrum::initializeGL()
|
|||||||
glFunctions->initializeOpenGLFunctions();
|
glFunctions->initializeOpenGLFunctions();
|
||||||
|
|
||||||
//glDisable(GL_DEPTH_TEST);
|
//glDisable(GL_DEPTH_TEST);
|
||||||
m_glShaderSimple.initializeGL(openGLVersion);
|
m_glShaderSimple.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderLeftScale.initializeGL(openGLVersion);
|
m_glShaderLeftScale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderFrequencyScale.initializeGL(openGLVersion);
|
m_glShaderFrequencyScale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderWaterfall.initializeGL(openGLVersion);
|
m_glShaderWaterfall.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderHistogram.initializeGL(openGLVersion);
|
m_glShaderHistogram.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderTextOverlay.initializeGL(openGLVersion);
|
m_glShaderTextOverlay.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderInfo.initializeGL(openGLVersion);
|
m_glShaderInfo.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderSpectrogram.initializeGL(openGLVersion);
|
m_glShaderSpectrogram.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderSpectrogramTimeScale.initializeGL(openGLVersion);
|
m_glShaderSpectrogramTimeScale.initializeGL(majorVersion, minorVersion);
|
||||||
m_glShaderSpectrogramPowerScale.initializeGL(openGLVersion);
|
m_glShaderSpectrogramPowerScale.initializeGL(majorVersion, minorVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLSpectrum::openGLDebug(const QOpenGLDebugMessage &debugMessage)
|
void GLSpectrum::openGLDebug(const QOpenGLDebugMessage &debugMessage)
|
||||||
|
Loading…
Reference in New Issue
Block a user