QtCreator 4.7 Cube OpenGL ES 2.0 example / And how to get it running on the N9 (MeeGo-Harmattan)

This is something like a note to self, because this is the second time I had to figure this one out.

So, yes, I eventually bought the N9. It is black with 64GB. I got it used and over two years after it was initially available. I felt a bit bad, because my old phone was working great, but then again my old phone went into good use now, to replace a slightly broken phone somewhere else in the galaxy.

Ok. This was supposed to be a post about how to get that Cube OpenGL ES 2.0 example running on the N9.

The problem seems to be that the shaders don’t get linked correctly. This was because the QGLShaderProgram object gets created too early. In the constructor for the class MainWindow, remove the line that creates a new QGLShaderProgram.

Like this:

MainWidget::MainWidget(QWidget *parent) :
QGLWidget(parent),
timer(new QBasicTimer),
//program(new QGLShaderProgram), //so remove this line
geometries(new GeometryEngine)
{
}

And then insert the creation line into the initShaders method:


void MainWidget::initShaders()
{

program = new QGLShaderProgram();

// Overriding system locale until shaders are compiled
setlocale(LC_NUMERIC, "C");

// Compiling vertex shader
if (!program->addShaderFromSourceFile(QGLShader::Vertex, ":/vshader.glsl"))
close();

................
etc.

That should get the example running with QtCreator 4.7 and the N9, as long as you change your project build/run settings to the N9 thing you’ve created earlier…

Advertisements