user2812951
user2812951

Reputation: 21

Qt OpenGL OSX rendering slow, Windows fast on same machine

I am rendering a mesh using OpenGl through Qt. (Qt 5.4).

On my OSX computer the rendering is relatively slow. When I rotate the mesh I can see that the rendering can't keep up with my mouse input.

On the same OSX computer when running a Windows 7 virtual machine and my application the rendering is silky smooth. It almost looks like the Mac version is rendering in software mode, instead of using acceleration.

I used glGetString to check the vender and renderer being used and this looks ok:

"NVIDIA Corporation"
"NVIDIA GeForce GT 650M OpenGL Engine"

Any ideas why the native OSX generated code would run so much slower.

BTW: I am rendering a mesh composed of about 150,000 vertices using a GL_ARRAY_BUFFER.

I am quite new to OpenGL, any ideas?

Upvotes: 0

Views: 973

Answers (1)

user2812951
user2812951

Reputation: 21

I'm answering this question so that it can be closed.

As Kuba Ober indicated in the comments above the problem was caused by an opengl mistake that Windows appeared to be hiding. In my case I forgot to call the QOpenGLShaderProgram::disableAttributeArray() function, ex:

program->enableAttributeArray(texcoorLocation);
glVertexAttribPointer(texcoorLocation, 2, GL_FLOAT, GL_FALSE, 0, uv);
glDrawElements(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, indices);
program->disableAttributeArray(texcoorLocation);  //<-- this line was missing

It seems Windows forgave this problem, while OSX did not.

Upvotes: 0

Related Questions