-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
beginTextureFills being scaled incorrectly sometimes #121
Comments
Hi. I've been looking at this for a little bit, but I dont see anything at all within the drawn square here. I cant get the renderTexture to work at all? Could you provide a screen shot of what you see? I can absolutely agree that "nothing" doesn't seem right :) |
The feature works as can be expected with a regular texture for me, but not with a RenderTexture Edit: Well, maybe not. When I do beginTextureFill and then draw a circle, things get weird. So ok, this is broken.I'm wondering how the fill stuff is supposed to work, and I really don't understand the "scale(1/256, 1/256)" call mentioned in the other thread, in the Fill class constructor |
The problem here is that your texture is "officially" 200x200, but in "reality" it is 256x256, and the texture coordinates gets mapped out between 0.0-1.0 , ie , all the way to 256 of the rect. So, unfortunately, the scaling has to be done by a UV-matrix. Basically this:
I am most likely doing the math wrong, I have no real time to devote to this at the moment. But the uvMatrix has to be scaled to compensate for the ratio of the power of two width and height of the texture. And, yes, this is a severe limitation on the usability of the graphics API. |
Thanks a lot for your help, I'll try this solution :) |
Hi @IonSwitz , I am using latest Starling 2 and beginTextureFill does not work at all. When I am drawing with line to nothing is visible. Do you maybe know to reason? Normal color fill with beginFill(0xFF0000, 1) is working great? |
Hi, I reopening issue #82 (comment) .
Problem still exist. Example for reproduce:
var renderTxt:RenderTexture = new RenderTexture(200, 200);
var shape:Shape = new Shape();
shape.graphics.beginFill(0xFF02F1);
shape.graphics.drawCircle(100, 100, 100);
shape.graphics.endFill();
renderTxt.draw(shape);
shape.graphics.clear();
view.addChild(shape);
shape.graphics.beginTextureFill(renderTxt);
shape.graphics.moveTo(0, 0);
shape.graphics.lineTo(200, 0);
shape.graphics.lineTo(200, 200);
shape.graphics.lineTo(0, 200);
shape.graphics.endFill();
Filled circle is smaller than it should be.
The text was updated successfully, but these errors were encountered: