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
drawToBitmapData using a scale #525
Comments
Sorry for the delay! As you expected, using a RenderTexture is unfortunately not possible, because we cannot read the bitmap data back from a texture. 😒 One more question, to see if I understand this correctly: if you do the same on Desktop, also with a non-zero scale factor, then it does work, right? If that's the case, this definitely looks like a bug in stage3D to me. I think the best way to continue would be to create a small sample using just plain stage3D code, and to create a bug report on Adobe's bug tracker. Could you try to create such a sample? That would be a huge help for me. You probably just need to add the Just ping me if you need any help, or if you're not successful with the test. |
Yep, on desktop there's no need for an offset. I'll try and create a test project sans Starling; I've not really touched raw Stage3D. It'll probably be after the weekend; Ludum Dare and all 😉 |
Thanks, I really appreciate your help! 😄 |
Just to let people know, the bug is still persistent in AIR SDK 14 - 7/8/2014 Release. 😒 I implemented the workaround as divillysausages suggested - checking SystemUtil.isDesktop & applying y offset - and it works fine on devices including iPod touch 5th generation(iOS 7), iPad 3(iOS 6) and LG Optimus G Pro (4.1.1). Thanks divillysausages! 😄 |
Yeah, I really need to get off my ass and write the test class for Daniel; it's been on my back burner for ages now :) |
Since this sounds more like a stage3D issue, and since there hasn't been any progress for a while, I'm now closing this issue. Feel free to open it up again if you want to continue this discussion. |
As mentioned in issue #517, when drawing the stage with a scale other than
1.0
, the position of objects are offset on mobile (testing using an iPad mini & Galaxy S3).Basically as
scale
approached0.5
, objects would be offset by the screen height; lower than0.5
and they'd be off the screen.2 things would fix it:
1) Applying an offset when calling
setOrthographicProjection()
This needs to be separated between desktop (only tested on windows though) and mobile (maybe using
SystemUtil
?).When setting up the
RenderSupport
:The
w * 1.0 / scale
andh * 1.0 / scale
is there to fix theclipRect
problem mentioned in #517The
y
offset for the orthographic projection is needed, as if theRenderSupport.renderTarget
isnull
, it'll render in the back buffer. Why it's necessary to correct the offset only for mobile, and only for they
axis is beyond me 😄2) Use a
renderTarget
for theRenderSupport
:If the
renderTarget
isnull
, then it's rendered into the back buffer, so you can specify an empty target instead:If we use a
RenderTexture
, then we don't have to set thewidth
andheight
fix for theclipRects
in thesetOrthographicProjection
call, though I'm not sure it's possible to get the resulting texture as aBitmapData
? Only theContext3D
class seems to have adrawToBitmapData()
method.In an somewhat related note, I found that calling
Starling.current.context.present()
at the end of all this to actually cause a flicker rather than prevent one, when using the first fix, as, because you're rendering to the back buffer, it'll show one frame (the one you just rendered) with the scale messed up.You can either omit the call, or re-render the stage at scale
1.0
. Something like this:This obviously has a downside of rendering twice just to get a screenshot.
The text was updated successfully, but these errors were encountered: