Simple model viewer using three.js in electron

hi.

i try to make a simple model viewer on desktop using electron.

but i have a problem. here is my step.

  1. Read a geometry data from file in main process.

  2. Create a BufferGeometry (main process).

  3. Pass a BufferGeometry instance to renderer process using ipcrenderer

  4. Make mesh and add to scene (renderer process).

  5. console are some error: ‘Uncaught TypeError: geometry.addEventListener is not a function’.

i print log for passed geometry instance. and it seems look like not have problem.

so, how can i fix it?

do i pass to just data only and create geometry, mesh in renderer process?

best regards.

Have you realized that the official editor can already be used with electron? Just run npm install and then npm run editor in the main directory of the repository. Maybe you can use this implementation as an orientation for your own project.

1 Like

Are you trying to create a desktop application, or just generate screenshots?

I have an example of an electron model viewer here, note the packaging steps. For screenshots I’ve found electroshot quite helpful.

1 Like

Mugen87, thanks for know to me. i will check that example.

donmccurdy, i try to desktop application for my custom model format.

and thanks guys, your advice are very helpful for me both of you.

I think ipcrenderer will convert to/from json, so you lose functions in the process

Is it possible to have the editor work with Qt5?

@GlifTek Sorry, I’m not familiar with Qt5. I also think that your question is way too broad. I mean you are asking if a C++ library “works” with a JavaScript based WebGL scene editor. TBH, I don’t understand the relation between both things…

Hi, yeah sorry, I’m just becoming familiar with qt5 myself. The reason I brought that up was because I had just been reading about this new library made for Vue to use Qt to make desktop apps, Vue node gui, and there was much discussion about comparing qt5 to electron.
I know there are Vue/three.js APIs so I guess I’m looking for a similar way as you described above to streamline the editor-Vue-qt process, as one would with electron.

Again, I’m just learning.
Thanks