Jump to content

Bug generating a texture from graphics?


Josepho
 Share

Recommended Posts

HI there!

 

I have been trying to create a rectangle and then create a sprite with it, I tryed this code but it shows an error

 

var graph = new PIXI.Graphics();
graph.beginFill(0xFF3300);
graph.drawRect(0,0,300,300);
graph.endFill();
 
var img = PIXI.Sprite(graph.generateTexture());
 
this.addChild(img);
 
The error says this
Uncaught TypeError: Object #<Object> has no method 'onTextureUpdate'
 
I am doing anything wrong??
Link to comment
Share on other sites

Hello, well, probably a bug, because the bounds of the PIXI.Graphics doesn't work with rectangles and circles/ellipses, probably they will fix it later.

You need to define the bounds on your own.

graph.bounds = new PIXI.Rectangle(x,y,width,height);

There is also a padding defined with a default value of 10.

You can null this by: graph.boundsPadding = 0;

Link to comment
Share on other sites

Hello, well, probably a bug, because the bounds of the PIXI.Graphics doesn't work with rectangles and circles/ellipses, probably they will fix it later.

You need to define the bounds on your own.

graph.bounds = new PIXI.Rectangle(x,y,width,height);

There is also a padding defined with a default value of 10.

You can null this by: graph.boundsPadding = 0;

 

This bug was fixed in the dev version of pixi, likely your code works fine using that version.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...