While working on a WebGL scene using Three.js, I encountered an issue. I am attempting to load a .obj model with Three.js and apply a blue color to it instead of using a mtl texture. Here is the approach I tried:
// instantiate a loader
var loader = new THREE.OBJLoader();
// load a resource
loader.load(
// resource URL
'model_path.obj',
// Function when resource is loaded
function ( object ) {
scene.add( object );
}
);
However, I received the following error message:
WebGL: INVALID_VALUE: bufferData: no data
Uncaught TypeError: Cannot read property 'length' of undefined
[.CommandBufferContext]GL ERROR :GL_INVALID_VALUE : glVertexAttribPointer: size GL_INVALID_VALUE
I am seeking advice on how to resolve this error and successfully load an obj model with a blue color applied. Your assistance is greatly appreciated!