These are chat archives for pixijs/pixi.js

26th
Oct 2017
@R_Talon_twitter
Oct 26 2017 11:07

Hello again!!! What is the best way for upload Textures to GPU before to play?
I Have a huge textures, three 4094x4096. I want to load in GPU.

renderer.bindTexture?
renderer.plugins.prepare.upload?

Thanks!!

Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 12:37
renderer.textureManager.updateTexture(myTexture)
also it can be unloaded automatically by GC if its not used for some time
renderer.textureGC.mode = PIXI.GC_MODES.MANUAL switches it off
please study how textureManager and textureGC works from pixi sourcecode to get more info
@R_Talon_twitter
Oct 26 2017 12:40
updateTexture(myTexture) -> myTexture is "xxx_image"?
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 12:40
its Texture or BaseTexture
if its Texture, it takes baseTexture from it and uploads it
please read the docs about Texture and BaseTexture
if you want to upload an atlas, you can pass just one of its textures and it'll be done.
@R_Talon_twitter
Oct 26 2017 12:42
I'm using AnimatedSprite
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 12:42
pre-uploading includes A) browser decodes PNG into RGBA B) webgl uploads it to GPU
A) has higher cost
there're no method about it in HTML5 (except createImageBitmap that'll be used in pixi-v5)
so you really have to read all about those things to understand whats going on
I cant explain it easily :(
@R_Talon_twitter
Oct 26 2017 12:44
ok ok, I know
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 12:44
if you use AnimatedSprite, you need to pre-upload all of its basetextures
if all textures are from same atlas, then its only one basetexture
@R_Talon_twitter
Oct 26 2017 12:48
ok ok, I am not familiar with this. thanks!!
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 12:57
one more approach is to experiment with this thing or debug it until it works like you want it
its not the most difficult thing we have. yesterday in pixijs slack on #shaders channel we had a discussion about filters and positioning inside fragment shader
@finscn read my article about filters several times, but only yesterday, when we spent some time debugging his filter he understood what I meant there :)))))
@R_Talon_twitter
Oct 26 2017 12:59
jajajaja yes. debugging is the way, always :D
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 13:00
in some cases for some people - docs are enough. in most cases, you have to experiment until you get it
@R_Talon_twitter
Oct 26 2017 13:01
There are a lot of examples about this. but the problem is that this evolving
anyway, thanks Ivan!!!
Ivan Vodopiviz
@ivodopiviz
Oct 26 2017 13:11
welcome to web technologies, where conventions don't exist and staiblity doesn't matter haha
@R_Talon_twitter
Oct 26 2017 13:48
xD
Ivan Popelyshev
@ivanpopelyshev
Oct 26 2017 17:33
@ivodopiviz lol :)