question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I red this question #814

And also I run onto this js library: http://code.google.com/p/canvg/ which can do SVG to canvas to data conversion.

This is my code:

var imageCanvas2 = document.createElement("canvas");
canvg(imageCanvas2, 'images/46.svg');
var imag = imageCanvas2.toDataURL('image/png');   // --> here is the converted image data

var cubeMaterial = [new THREE.MeshBasicMaterial({
    map : THREE.ImageUtils.loadTexture(imag)
})];

This gives me error: “Cross-origin image load denied by Cross-Origin Resource Sharing policy.”

What are my options here?

Also I should mention that WebGL is not an option since I will be using this on mobile devices which don’t support WebGL.

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

30reactions
Dino4674commented, Feb 12, 2012

My god… I can’t believe how stupid. This works on iOS also.

I have an SVG image which is the same color as WebView’s background so that is why I didin’t saw it 😄 At least it works and someone can laugh now when reads this 😄

4reactions
mrdoobcommented, Feb 12, 2012
var imageCanvas2 = document.createElement("canvas");
canvg(imageCanvas2, 'images/46.svg');

var texture = new THREE.Texture(imageCanvas2);
texture.needsUpdate = true;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to use .svg as texture in blender 2.9?
Is there any way to use SVG File as an Image Texture inside Blender? ... No, you have to render/convert the svg-vector-format into...
Read more >
SVG Textures - VISIWIG
Generate scalable vector graphic spots, scratches, splatters, grunge, and grit with our SVG texture maker.
Read more >
Blender Tutorial: SVG and Texture Project - YouTube
Learn how to complete the SVG and Texture project in Blender.
Read more >
SVG Texture Support ⁠— Right-Click Select
Having support for SVG textures in the image texture node would allow for resolution-independent workflows. A practical example is product visualization. In ...
Read more >
Is there a way to use .svg as texture in blender 2.8 - Reddit
I am trying to achieve comic style look with lot of handdrawn lines, used as texture map. ... You could import the svg...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found