-1

Again trying to make something NOT out of box. I'm facing the following issue: I was trying to change aspect ration of a camera like

Qt3DRender::QCamera *camera = view.camera();
    camera->lens()->setPerspectiveProjection(45.0f, 100.0f/*16.0f/9.0f*/, 0.1f, 1000.0f);
    camera->lens()->setProjectionType(Qt3DRender::QCameraLens::ProjectionType::PerspectiveProjection);
    camera->setPosition(QVector3D(0, 0, 40.0f));
    camera->setViewCenter(QVector3D(0, 0, 0));

But apparently it has no effect what-so-ever. It's like this parameters is totally irrelevant to image formation. Could some one explain me how can I set aspect ration or any other method to set "uniform mat4 mvp;" if I have to use shader anyway.

Is there any concise reference on how CameraLens passes its value to shaders? The code is VERY big and intricated I'd rather not go too deep into it.

BDL
  • 21,052
  • 22
  • 49
  • 55
victor
  • 1
  • 1

1 Answers1

0

After studing the source code of Q3D I've found that aspect ration is dynamically changed by the engine. The only way to stop it is to use 'setProjectionMatrix' function which will stop automatic update of the projection matrix and everything will be left to handle for yourself (including culling calculation and correct projection matrix formation).

victor
  • 1
  • 1