mozgovipc Posted October 4, 2016 Share Posted October 4, 2016 Hi, I have some (limited) experience with libgdx, and I'm currently experimenting with PixiJS v4. I'm trying to create (and possibly update in time) a Texture/Sprite from raw RGB data (e.g. UInt8Array), please lmk if this is possible? Thanks! Quote Link to comment Share on other sites More sharing options...
xerver Posted October 4, 2016 Share Posted October 4, 2016 We don't currently have an easy way to do data textures. This is something I do want to add soon, because it can be pretty useful for a variety of advanced scenarios. You can always create a custom ObjectRenderer (see SpriteRenderer and MeshRenderer) and do anything you want with the GL context. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 5, 2016 Share Posted October 5, 2016 Yeah, PIXI doesnt know about array textures. But pixi-gl-core does! Lets hack that way we have access and PIXI wont know about it: var tempCanvas = document.createElement(canvas); tempCanvas.width = 100; tempCanvas.height = 100; var baseTex = new BaseTexture(tempCanvas); renderer.textureManager.updateTexture(baseTex); baseTex._glTextures[renderer.CONTEXT_UID].upload(100, 100, myDataUint8Array); There's only one tempCanvas needed, but you have to change its width/height every time you create new texture. Data from tempCanvas wont be used anyway, instead after initial uploading you'll reupload uint8array version. Don't forget that its only BaseTexture, you still have to create Textures and Sprites out of it P.S. Turn off the GC or it will ruin everything! renderer.textureGC.mode = PIXI.GC_MODES.MANUAL; Quote Link to comment Share on other sites More sharing options...
mozgovipc Posted October 5, 2016 Author Share Posted October 5, 2016 Hi, thanks for the ideas, I'll try to hack into pixi core. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.