Login  Register

Re: Transforming or Moving objects in opengl e3

Posted by elect on May 19, 2016; 6:41am
URL: https://forum.jogamp.org/Transforming-or-Moving-objects-in-opengl-e3-tp4036721p4036726.html

Jmaasing is right. The only optimizations you may want to implement, however, is calculating gl_Position in this way

gl_Position = proj * (view * (model * position));

rather than this:

gl_Position = proj * view * model * position;

So that you force always a mat * vec multiplication instead a mat * mat which is something more complex

And you may also want to pre-calculate proj * view on the cpu since those matrices are supposed to stay per-frame constant, so

gl_Position = projView * (model * position);

Anyway, it's very difficult to see improvements by things like this unless very very special conditions apply, because usually one has much stronger bottlenecks somewhere else