Hi,

On 10/07/2016 15:57, Midori Yakumo wrote:
In this QML code:

https://github.com/MidoriYakumo/learnopengl-qt3d/blob/master/qml/hellotriangle.qml
I want to draw a triangle like this C++ code:
  http://learnopengl.com/code_viewer.php?code=getting-started/hellotriangle


I found that I have to clear both color and depth buffer, that's weird:

activeFrameGraph:ClearBuffers { buffers: ClearBuffers.ColorDepthBuffer
// Why not ColorBuffer only??? clearColor: Qt.rgba(0.2, 0.3, 0.3, 1.0)
RenderSurfaceSelector { } }

Because by default Qt 3D enables depth testing and writing as this is by far the most common use case. Thus when you first draw your triangle all is well as all fragments that get rasterised pass the depth test. On subsequent frames this is not the case. The default depth test is "less than" so all your new fragments will fail the depth test and not get written to the framebuffer and since you already cleared the color buffer you will see nothing.

Either disable depth testing or just clear the colour and depth buffers as you are doing. You will likely need depth testing when you progress on to more complex meshes anyway.

Cheers,

Sean



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


--
Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to