12

Some question asked about how can use obj in webgl. But my question is how can get/save/export obj or ply file from content of canvas in webgl?! For example how can I get two objects in obj format in following link? http://learningwebgl.com/lessons/lesson04/index.html

Of course all of my webgl target not is simple such as upper link, and and converting gl code from webgl to opengl is so hard and time consuming.

Then I have to get result object from webgl; but how?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Aref Hemati
  • 337
  • 2
  • 14
  • If it's displayed on canvas it should be stored somewhere in JS code, just find that place and download it. It will work unless you want to have generic solution working for any site. – janisz Jan 03 '15 at 14:08
  • No, i want to get obj or ply only. i access to all webgl code, but my problem is that, i need 3d ply or obj object can view in meshlab, not 3d object in webgl viewer. – Aref Hemati Jan 03 '15 at 17:16
  • So you somehow process vertices and normals in webgl, somewhere under the hood you draw triangles. Just find this place and instead drawing triangle save it's coordinates. This will give you something like [STL](http://en.wikipedia.org/wiki/STL_%28file_format%29) supported by [MeshLab](http://meshlab.sourceforge.net/) – janisz Jan 03 '15 at 19:30
  • Converting between WebGL and OpenGL is quite simple, having the raw buffers in javascript its also quite easy to write them out as `obj` files, that is if you know how an obj file looks like. Otherwise I assume you're trying to rip assets you're not supposed to... – LJᛃ Jan 03 '15 at 22:51
  • 1
    @LJᛃ for the sake of closing this answer and helping out the nearly 4000 people that have come to this question seeking help, could you give an example? I'm also stuck on this and really need help figuring this out for a work project. – Tony Mar 16 '19 at 07:09
  • @zfb what I said 4 years ago still holds, especially the latter part, if there's a different reason I'd be curious to hear what it might be. – LJᛃ Mar 16 '19 at 23:06
  • 3
    @LJᛃ like accidentally deleting your source model file and not realizing it after the client requests some changes be made to the model x.x I could see that being a fairly valid reason x_x – Tony Mar 16 '19 at 23:27

0 Answers0