AnsweredAssumed Answered

Graphical corruption when using Uniform Buffer Objects on iMX6

Question asked by Hartmut Behrens on Jun 8, 2017
Branched to a new discussion



I've modified a Qt textures example ( ) to test out UBO functionality on the iMX6 (using a SABRE board with 6QP AP) - see attachment for the complete modifications. Below I have reproduced the shaders. When the example is run, a lot of graphical corruption can be seen in the spinning cubes.


Has anyone else experienced this ? Do you know of any workarounds / fixes ?


QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this);

QString vsrc =

"in vec4 vertex;\n"

"in vec2 texCoord;\n"

"out vec2 texc;\n"

"uniform int rotIndex;\n"


"int getRotoationIndex(void);\n"

"mat4 getRotationMatrix(int Index);\n"

"mat4 getRotationMatrix(void);\n"


"struct VertexData {\n"

" mat4 rotMatrix;\n"


"layout(std140) uniform u_VertexData {\n"

" VertexData vData[64];\n"



"int getRotationIndex(void) { return rotIndex; }\n"

"mat4 getRotationMatrix(int Index) { return vData[Index].rotMatrix; }\n"

"mat4 getRotationMatrix(void) { return getRotationMatrix(getRotationIndex()); }\n"


"void main(void)\n"


" mat4 rotMatrix = getRotationMatrix(rotIndex);\n"

" gl_Position = rotMatrix * vertex;\n"

" texc = texCoord;\n"



QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this);

QString fsrc =

"#ifdef GL_ES\n"


"precision highp float;\n"

"precision highp sampler2D;\n"


"precision mediump float;\n"

"precision mediump sampler2D;\n"



"in vec2 texc;\n"

"out vec4 fragColor;\n"

"uniform sampler2D tex;\n"

"void main(void)\n"


" fragColor = texture(tex, texc);\n"


Original Attachment has been moved to:

Original Attachment has been moved to: