Comments (5)
Thanks @floatdrop, an interesting point!
Seems like you cracked the solution.. Was thinking of adding a PIXI.getBaseTexteureFromImage function.. may make life a little clearer?
from pixijs.
Thank you for fast respone, @GoodBoyDigital! I don't think, that duplicating methods for this make someone life easier. But. also I can't propose a good solution.
May be will be better to allow create texture from texture by adding code like this to Texture.js:19:
if (baseTexture instanceof PIXI.Texture)
baseTexture = baseTexture.baseTexture;
This will guarantee, that all textures have BaseTexture in baseTexture field.
Or may be better to rethrow event in Texture.js:72 like this:
this.scope.dispatchEvent( { type: 'loaded', content: this } );
but it only updates an width and height, so it is not full solution.
I prefer to just mention it in documentation, that you cannot create Texture from Texture, because I don't see, why there is such limitation (Texture inherited from BaseTexture), therefore I cannot propose a proper solution. Could you clarify the reason of this non-inheritable behavior?
from pixijs.
I honestly think the best thing here would be to have PIXI.BaseTexture.fromImage
which PIXI.Texture
would use under the hood. That way you don't duplicate code, and I can get a BaseTexture without the overhead of a useless texture on top.
from pixijs.
Excellent idea @englercj Will add that to the code base for sure.
@floatdrop I think the name of the class "baseTexture" may be slightly misleading. Think of it as a texture source.
In a nut shell: A texture needs a source (baseTexture) and a frame (rectangle)
Hope that helps!
from pixijs.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from pixijs.
Related Issues (20)
- Feature Request: Video autoPlay for bundle asset loading HOT 1
- Pixi Text not showing the dynamic font loaded through Assets
- Bug: Unexpected Height during Initialization Pixi App HOT 1
- Bug: incorrect text stroke drawing with some fonts HOT 3
- Feature Request: Change the default priorities of the compressed textures formats HOT 1
- Bug: Asset format is not resolved correctly
- Feature Request: Make deprecation() warnings optional HOT 1
- Impossible to set sprite filters as an empty array to then add multiple filters HOT 4
- Feature Request: Is there a way to scale a Graphics without getting the linewidth scaled as well?
- Bug: [v8] Compressed textures are not being rendered HOT 6
- Bug: PIXI.Graphics method lineTo at later call different
- Bug: Argument of type 'Sprite' is not assignable to parameter of type 'DisplayObject'. HOT 4
- Bug: http://gametest.mobi/pixi/morph is down HOT 2
- Bug: Stutter in basic animation on various browsers and OS HOT 1
- Save and load the current state of the application
- Bug: Graphics scaling and adding filters, display abnormal
- Bug:
- Bug: Unexpected behaviour of alpha on Graphics HOT 1
- Bug: [v8 regression] cannot do many `moveTo`/`lineTo` HOT 13
- Bug: API Documentation URLs Leading to 403 Errors HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixijs.