frenchtoast747 / webgl-obj-loader

A simple OBJ model loader to help facilitate the learning of WebGL.
http://frenchtoast747.github.io/webgl-obj-loader/
MIT License
281 stars 59 forks source link

Using the meshes in other GL libraries like ThreeJs #2

Closed venidev closed 6 years ago

venidev commented 11 years ago

Thanks for the obj loader, very helpful library. Is it possible to use the Mesh in other libraries like ThreeJS?

frenchtoast747 commented 11 years ago

As of right now, this WebGL Obj Loader is not directly compatible with ThreeJS (there are no helper functions to convert to ThreeJS). For some reason it is not documented, but ThreeJS does have an OBJ loader. An example of it being used can be found here: http://mrdoob.github.com/three.js/examples/webgl_loader_obj.html

Look for the line in the main <script> tag that looks like this: var loader = new THREE.OBJLoader();

An even handler is added, followed by the OBJ file to load: loader.load( 'obj/male02/male02.obj' );

At least for the creation of this loader, it was originally intended for my WebGL graphics class to be low level so that we all could learn WebGL without having to hard code models (and ugly ones at that). However, I will see if I can make it compatible with ThreeJS (although, I would highly suggest checking out their Obj Loader first).

Thanks for the interest!

nickdesaulniers commented 9 years ago

I appreciate the current API. If this compatibility can be added without changing the existing API, I'm for that, but I'm using this library without Three.JS as well.

frenchtoast747 commented 6 years ago

ThreeJS supplies its own OBJ and MTL loaders that work well with ThreeJS, so this issue will not be worked. The focus of this library is to be a simple parser/loader specifically for the OBJ/MTL formats and should be structured in such a way that helps facilitate the learning of WebGL and its underlying shading languages.