Any ideas why my app would draw a black screen when it's dormant/suspended (user presses window-key, and then long-presses back-key to view all dormant apps)?
It's Directx113D app, and should be very close to the implementations of Marble Maze and Direct3D samples. They show up just fine.
I've done my best to break these two samples in a similar fashion but no luck. Any ideas?
Okay, I've got this one solved.
The problem was with alpha. I don't know why, but when the app has the focus, it draws alpha just fine. However, when send to background alpha blending somehow is turned of and alpha for each pixel remains 0. For my blendstate I changed:
SrcBlendAlpha = D3D11_BLEND_ZERO
DestBlendAlpha = D3D11_BLEND_ZERO
to
SrcBlendAlpha = D3D11_BLEND_ZERO
DestBlendAlpha = D3D11_BLEND_ONE
Related
I tried rendering using Libgdx's DecalBatch on my phone and my friend's phone. It's rendering a 2D image with thickness.
A decal at the front and back side is created, then individual decals for every pixel at its side.
Then, I flush (render) the decals.
On my phone, it gave this result:
It worked as expected.
However, on my friend's phone, it didn't render at all:
It didn't work as expected.
How do I fix this? Or is it a bug in Libgdx?
I've got it working now!
I forgot to add this one line of code:
Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
I mainly forgot to put the depth buffer bit.
Anyways, thank you to everyone who has helped.
I have this problem that is driving me nuts!
So, when I draw a boxshape body with an angle different to zero on SpriteBatch(and even on Box2DDebugRenderer happens the same), the body looks pixelated in my computer's screen. This problem persists even when I run the application in my phone. I've been searching (A LOT) about this, and I have not found anything to solve this. Most people that had similar problems (not with an angle) found solutions by changing the .setFilter to LINEAR, but that did not do anything for me.
I tried to put an image of the problem here, but apparently I need 10 points :(
So here is a link with the image :)
http://postimg.org/image/xgeqttpvd/
I would really appreciate if you know the solution for this!!!!!!!!!
You are seeing aliasing from the edges of the rectangle of your sprite. You have two options. The first is to turn on antialiasing, which you can do like this in the desktop launcher and in the android launcher (not in the core project):
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.numSamples = 4; //or 2 or 8 or 16
initialize(new MyGdxGame(), config);
or on Desktop:
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.numSamples = 4; //or 2 or 8 or 16
new LwjglApplication(new MyGdxGame(), config);
However, this will not perform very well on a phone if your game has very many sprites at all. A better way to do it is make a sprite that has a transparent border built in. Something like this (screenshot from Gimp to show transparency:
Then if you use LINEAR filtering, it will clean up the edges, because the visible edges are internal to the sprite, and not aligned with the actual polygon. Note that you will have to adjust your sprite to be slightly larger than your box2d body so it visually matches the body.
So, I'm pretty much a beginner in Flash and Actionscript (using AS3, as I said in the title), and I'm trying to make a basic escape the room game. I haven't gotten far, and right now that's because every time I test my game (or publish preview it) the graphics get this annoying outline. Here it is when tested: http://i305.photobucket.com/albums/nn228/chokingondrama/flash.png
Every outline corresponds to some object present in the game, most of which have an alpha component of 0 since they're on different sides of the room. This didn't happen before, but once I added the code that allowed the player to change their view with the arrow (each viewpoint/wall is a different frame) these appeared.
It's a little different when published to HTML, basically it just gives each image a white background: http://i305.photobucket.com/albums/nn228/chokingondrama/html.png
Also, it would be nice if somebody could give me advice on how to make sure importing to flash won't result in lower quality.
Thanks in advance. If needed, I'll post any part of the code.
Some tips:
Don't set alpha to 0, instead use the visible property, setting movieclip.visible = false will make it a lot more efficient.
As for the importing and quality, after you import to stage or library, bring up the library (ctrl + l), and right click on the file you imported, go to properties. If it's an image, set compression to lossless, and allow smoothing.
For audio, go to file-> publish settings, and change audio stream and audio event (whichever you might use) to 128kbps.
As for your main question, I need more info, if you want you can post your source. It might be because of how you are placing your graphics on the stage.
For each of your MovieClips in question:
Try disabling button mode and see if the rectangles go away.
movieClipName.buttonMode = false;
If that doesn't help, or you really want button mode, try setting
movieClipName.tabEnabled = false;
There's a chance that since you added keyboard interaction each of your MovieClips are now expecting to be selected by the user when they press the tab key, much like any normal web form.
tabEnabled in the docs
You could also try
movieClipName.focusRect = false;
focusRect in the docs
I've built an AIR application with flash/as3 that has a webcam display on the stage. While building the app, and in all my tests everything looks and works just dandy, but when I publish for AIR the image gets stretched. The bounds of the image seem to stay the same, but the actual cam output is what's distorted. Has anyone come into this problem before?
I should add, this is a desktop app, which is permanently installed on one machine, so device compatibility should not be an issue.
this is the camera setup:
var cam:Camera = Camera.getCamera();
cam.setMode(280,380,20);
var video:Video = new Video(380,380);
this is where i first call the camera...
video.attachCamera(cam);
video.x = 355;
video.scaleX = -1;
video.y = -100;
addChildAt(video, 0);
the reason for the odd sizing, is that it sits behind a frame, that changes positions throughout the interactive.
Not necessarily the answer you are looking for, but you should keep this in mind:
You are asking the camera to capture at the resolution of 280 x 380, which is not a standard 4:3 aspect ratio.
When you call cam.setMode(280,380,20); the docs say that Flash will try to set the cameras resolution to your specifications, and if the camera does not support that resolution it will try to find one that matches. So you may or may not be getting this actual resolution.
setMode() has a fourth parameter, which can disable this functionality. Read the docs on that so you understand the implications :)
Then you display the video in a Video object that is 380x380. So I would expect the image to be stretched in the horizontal direction (b/c the original source is only 280).
It's not clear why this behaves differently: are you saying that running the debug version of the app works, but when you export the release build and run that it looks funky?
Finally, what is scaleX = -1 doing? I recall this as some sort of nifty trick I used in the past... but it's purpose here is escaping me :)
Yep, source code would be cool. Btw, i suggest you, as soon as you get the video streaming running, to set by hand the video.width and video.height property.
This will force the cam to display at the correct size.
I developed a mobile app inside Adobe Flex (4.6) and it includes using pinch-to-zoom functionality to zoom in on pictures to make it easier to read words in the pictures. In previous android versions (2.1 to 2.3.3 and 2.3.4 if you're running cyanogenmod) the pinch-to-zoom works fine. But if the app is run on an ICS (Android 4.x) device, the axes seem to handle the enlargement of the picture individually. i.e. when you move your fingers apart horizontally, the image gets very wide, but stays the same vertical size, and vice versa.
First, does anyone know why this is happening?
And second, does anyone know of a way to fix it to work as it did before?
I will update to include screenshots.
Update: I have confirmed this is also an issue with Honeycomb. i.e., 3.x OS acts the same as 4.x ICS.
Sense, running the latest HTC update:
ICS, on AOKP, but verified this is an issue with standard ICS distros as well:
Solved this. Code was previously:
protected function onZoom(e:TransformGestureEvent, img:Image):void
{
DynamicRegistration.scale(img, new Point(e.localX, e.localY), img.scaleX*e.scaleX, img.scaleY*e.scaleY);
}
change the final e.scaleY to e.scaleX. This makes it scale based on only one portion of the zoom (in the x direction) and scales both X and Y accordingly. Not exactly perfect, but it works very well in practice.
Final code is this:
protected function onZoom(e:TransformGestureEvent, img:Image):void
{
DynamicRegistration.scale(img, new Point(e.localX, e.localY), img.scaleX*e.scaleX, img.scaleY*e.scaleX);
}