These are chat archives for pixijs/pixi.js

3rd
Jul 2016
Jacob Bogers
@jacobbogers
Jul 03 2016 00:45
hi
anyone here
Chad Engler
@englercj
Jul 03 2016 00:45
yes
Jacob Bogers
@jacobbogers
Jul 03 2016 04:18
hello
I am using pixijs, to replace some canvase fillRect functionality
I am using an existing canvas
This message was deleted
    life.pixijs = life.pixijs || {};
        if (life.pixijs.renderer) {
            life.pixijs.renderer.destroy(false);
        }
        life.pixijs.renderer =  PIXI.autoDetectRenderer(
            _width,
             _height,
              {view:real_canvas, transparent:true});

        if (life.pixijs.Container ) {
            life.pixijs.Container.destroy(true);
        }
        life.pixijs.Container = new PIXI.Container();

        if (life.pixijs.Graphics){
            life.pixijs.Graphics.destroy();
        }
        life.pixijs.Graphics = new PIXI.Graphics();

        life.pixijs.Container.addChild(life.pixijs.Graphics);
Am i doing this correctly?
"life" is just an object
Jacob Bogers
@jacobbogers
Jul 03 2016 04:23
do i need a container?
can i use the graphics objects directly
I will not be using sprites, etc, so....
Jacob Bogers
@jacobbogers
Jul 03 2016 04:54
I made a small demo on codepen for this problem http://codepen.io/jacobBogers/pen/LkLPqX
can someone tell me why I dont see my "gray" grid?
Jacob Bogers
@jacobbogers
Jul 03 2016 12:56
anyone here?
I am trying to draw a simple 2d rectangle
Jacob Bogers
@jacobbogers
Jul 03 2016 13:20
Hi Guys, I made a simple code thing to draw a rectangle ,
see (link posted) can someone help it is not working
Jacob Bogers
@jacobbogers
Jul 03 2016 13:27
to my i am following exactly the same sample code and docs, so not know why it is not working
Chad Engler
@englercj
Jul 03 2016 16:17
You never called render
renderer.render(container);
Jacob Bogers
@jacobbogers
Jul 03 2016 16:27
ahahahaha
ok
it works now thanks
question, is it me or does it take a long time before you see the gray grid
Chad Engler
@englercj
Jul 03 2016 16:31
creating the buffers for 23287 rectangles takes a while
you could draw one, and tile it with a tilingsprite
which on webgl would be infinitely faster
and roughly the same on canvas
Jacob Bogers
@jacobbogers
Jul 03 2016 16:35
aah, interesting
"..and roughly the same on canvas ..."--> what do you mean by this?
Chad Engler
@englercj
Jul 03 2016 16:35
if you use the canvas renderer
and do what you are doing now
or use tilingsprite
it will be roughly the same
Jacob Bogers
@jacobbogers
Jul 03 2016 16:36
i dont understand
Chad Engler
@englercj
Jul 03 2016 16:36
what is confusing?
WebGL renderer using tiling sprite is faster than what you are doing, but the canvas render will be roughly the same speed
Jacob Bogers
@jacobbogers
Jul 03 2016 16:36
ok, I used fillRect (canvas api method)
Chad Engler
@englercj
Jul 03 2016 16:36
no you use fillRect a Graphics API method
Jacob Bogers
@jacobbogers
Jul 03 2016 16:37
let me show you my "old" canvas (non pixijs) demo
Chad Engler
@englercj
Jul 03 2016 16:37
Honestly not germane to the discussion at hand
so I am trying to do the same thing using pixijs
if i use fillRect, it is pretty fast
Chad Engler
@englercj
Jul 03 2016 16:38
so does our canvas renderer
but the webgl renderer transforms them into buffers and draws with the stencil buffer
using a tiling sprite will be faster when using the webgl renderer
and for canvas would just be doing fillrect anyway
Jacob Bogers
@jacobbogers
Jul 03 2016 16:39
ok so I only get a "hit" setting up the buffer, then after that it is blazingly fast
Chad Engler
@englercj
Jul 03 2016 16:39
try it
if the perf isn't good enough with Graphics
use a tiling sprite
Jacob Bogers
@jacobbogers
Jul 03 2016 16:39
ok
performance.PNG
I have also a magnifiying glass, (just copy piece of the canvas and magnify it with ctx.drawImage )
is this possible to copy a piece of the webgl bitmap in a simular fashion?
Chad Engler
@englercj
Jul 03 2016 16:41
write a filter for it
or render your scene to a texture and enlarge (see: RenderTexture)
I've g2g
Jacob Bogers
@jacobbogers
Jul 03 2016 16:43
thanks @englercj
for your help