<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to I prepare models for Canvas3D view?]]></title><description><![CDATA[<p dir="auto">I am trying to learn how to display and interact with 3D models in qt. One way I am trying is using the Canvas3D. I opened the <em>canvas3d/interaction</em> example and tried replacing <code>barrel.json</code> file with my own file. I am using blender and the threejs plugin to generate the json file. Right now I am using the default blender monkey mesh and converting it to json. I have not changed the code for the sample app at all -- just replaced the <code>barrel.json</code> with my generated monkey mesh. Instead of an interactive 3D monkey head, I get the following error:</p>
<pre><code>Desktop_Qt_5_7_0_GCC_64bit-Debug/interaction...
QML debugging is enabled. Only use this in a safe environment.
qrc:/interaction.js:298: TypeError: Cannot read property 'vertices' of undefined
</code></pre>
<p dir="auto">This error is happening because the call to <code>parseJSON3DModel</code> is failing and returning <code>undefined</code>. I add a <code>console.log</code> to the function below to verify that:</p>
<pre><code>function handleLoadedModel(jsonObj) {
    log("*******************************************************************************************");
    log("handleLoadedModel ENTER...")
    var modelData = parseJSON3DModel(jsonObj, "");

    console.log("model is " + modelData);

    log("    "+theModel.verticesVBO);
    gl.bindBuffer(gl.ARRAY_BUFFER, theModel.verticesVBO);
    gl.bufferData(gl.ARRAY_BUFFER,
                  new Float32Array(modelData.vertices),
                  gl.STATIC_DRAW);
</code></pre>
<p dir="auto">So my question is: why is the call to parseJSON3DModel failing on 3D json models? I have tried this with a few different meshes now. How can I create a mesh or modify the Canvas3D code so that I can display 3D content?</p>
]]></description><link>https://forum.qt.io/topic/70253/how-to-i-prepare-models-for-canvas3d-view</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 15:13:03 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/70253.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Aug 2016 05:36:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to I prepare models for Canvas3D view? on Mon, 10 Oct 2016 14:31:10 GMT]]></title><description><![CDATA[<p dir="auto">Try to triangulate faces of your mesh (select your shape, switch to Edit Mode and press Ctrl+T ).</p>
]]></description><link>https://forum.qt.io/post/352996</link><guid isPermaLink="true">https://forum.qt.io/post/352996</guid><dc:creator><![CDATA[upenya]]></dc:creator><pubDate>Mon, 10 Oct 2016 14:31:10 GMT</pubDate></item></channel></rss>