I am learning three.js. I tried to display some text but I am getting CORS policy access blocked error on loading the font file. I have checked if the path passed is correct, tried putting the file in various locations, but still nothing. Here is my code to load the text:
var loader = new THREE.FontLoader();
loader.load('../Libraries/three.js-master/examples/fonts/gentilis_bold.typeface.json', function(font) {
var geometry = new THREE.TextGeometry('Hello three.js!', {
font: font,
size: 80,
height: 1,
curveSegments: 12,
bevelEnabled: true,
bevelThickness: 10,
bevelSize: 8,
bevelOffset: 0,
bevelSegments: 5
});
});
And the error I am getting is:
Access to XMLHttpRequest at 'file:///A:/Code/IIITH/computer-graphics-iiith/SRIP/Libraries/three.js-master/examples/fonts/gentilis_bold.typeface.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Can I please get help resolving this error? I am still learning three.js and don't know it in detail. What mistake am I making?