Allows loadTexture to load encoded data
See original GitHub issueCurrently loadTexture loads data from an url. It could be nice to let it loads data from base64 encoded data (something like data:image/png;base64,XXXXX for eg).
It nearly works with the current implementation, only that we get a Cross-origin image load denied by Cross-Origin Resource Sharing policy. error (in Chrome) because of this: loader.crossOrigin = this.crossOrigin;.
Also, the url is put in texture.sourceFile, something that we would avoid to do when the url is really raw data.
So, in the current implementation, I would replace:
loader.crossOrigin = this.crossOrigin;
loader.load( url, image );
texture.sourceFile = url;
by
var isRawData = url.substr(0, 5) == 'data:';
if (!isRawData) {
loader.crossOrigin = this.crossOrigin;
texture.sourceFile = url;
} else {
texture.sourceFile = '';
}
loader.load( url, image );
What do you think ?
Issue Analytics
- State:
- Created 10 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Three.JS - How to load textures of material from data URL?
var json = JSON.parse(myJSON); var _loadTexture = THREE.MTLLoader.MaterialCreator.prototype.loadTexture; THREE.MTLLoader.MaterialCreator.
Read more >Texture Loading in LWJGL3 | Coding a 2D Game ... - YouTube
Join the Discord: https://discord.gg/4tHeAkxNg7In this video I go over how to load textures in LWJGL3 using OpenGL. I go over what UV ...
Read more >Facebook Playable Ads - how to load Texture Atlas? - Phaser 3
To clarify, loading normal images is working just fine using base64 encoded ... atlases to load, given the restrictions Facebook provides?
Read more >Scripting API: Texture2D.LoadRawTextureData - Unity - Manual
This function fills texture pixel memory with raw data. This is mostly useful for loading compressed texture format data into a texture.
Read more >Load Texture from GPU - Unity Answers
I want to know if it's possible to load a texture from data stored in ... In my project, I have a server...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

And just to be safe…
Or…