NGUI elements are being shown as black area in iPod4 and iPhone4 - user-interface

I am working on a game in Unity3d and I am facing a bizarre problem. My NGUI elements are turned into a black area when I run the game into iPod4 and iPhone4. However it is working well in iPad, iPod5 and iPhone5.
It seems to me that in iPod NGUI is not able to get the corresponding Atlas. Even the UIlabel are being shown as a black area in NGUI. Does anybody know what the problem might be?
Is there any memory problem on a lower capability device that might cause this?

Black sprites in NGUI on mobile platforms are usually caused by your atlas being larger than what is supported by the hardware. It's a simple physical limitation. The hardware simply does not support textures of a larger size.
The iPad and iPad2 (originally, though this changed) are limited to 2k textures. The iPad 2 (now), 3 and 4, as well as the Mini, the iPhone 4S and 5, and the iPod 5 do have 4k texture support.
So that explains the issues you were having. A simple hardware limitation.

Hey guys I got the solution. The problem caused by NGUI Atlas which was of 4096*4096. I have lower the atlas's resolution 2048*2048. Now everything is fine.
Black sprites in NGUI on mobile platforms are usually caused by your atlas being larger than what is supported by the hardware. It's a simple physical limitation

Related

Three.js ouput different on firefox and mobile safari

I've got a scene with ~35k sprites which are all pretty much static. The goal is to create an image that the user can save, so having the output be consistent across platforms is ideal. Below is roughly the same scene as rendered in both browsers, firefox on my desktop on the left and mobile safari on an iphone 6 on the right. The ios one is a little blurrier because I just took a snapshot of it, but the code running on both is exactly the same.
It seems like the mobile safari version gets darker the more dense things are, like where the semi-transparent heads of the soldiers are overlapping it's just not averaging right. I've set premultipliedAlpha: false, messed with material blend modes, texture settings, and for the life of me I can't get the ios version to match. Any help would be appreciated! :)

IKImageBrowserView on retina screen

Has anyone successfully used an IKImageBrowserView with a Retina Mac? What I get is that the image size is wildly misinterpreted. Previously I was using CGImage images which don't have a logical size, so it makes sense that the browser can't draw the at the right size. However, I've switched to NSImage, created using -initWithCGImage:size: and that still doesn't work right.
My images are 244x184 pixels and should be drawn at a logical size of 122x92. When passing 122x92 as the size, they are drawn way too large, at about 180 pixels wide. If I pass exactly half this, 61x46, the size is correct, but the image looks downscaled and not sharp. If I pass 122x92 and run with NSHighResolutionCapable set to NO in Info.plist, everything works well.
My conclusion is that IKImageBrowserView is not Retina compatible even with the 10.10 SDK on a Retina MacBook Pro running OS X 10.11. Or am I missing something? Any pointers would be appreciated!
I discovered that I wasn't really thinking the right way. The browser is supposed to always scale its images, so that's why the Retina-sized images ended up larger. I just subclassed the browser to be able to use a custom cell and customize the image frame per cell. There are however some subtle bugs in the browser that cause it to scale the images just a little bit in Retina mode, but I was able to work around that by creating a custom foreground layer for each cell that contains the image without scaling. Problem solved. Hopefully this will help someone else in the future.

Should OpenGL game use UIScreen nativeBounds or bounds for iPhone6 plus?

My game engine currently uses UIScreen bounds for its rendering resolution. On an iPhone6 plus this reports the virtual resolution of 2208x1242.
On the simulator this is also that same resolution as reported by UIScreen nativeBounds.
However, on a real device nativeBounds will be 1920x1080, and I am unsure which to use for correct OpenGL rendering on an iPhone6 plus, and can find no official documentation on it.
Which one is correct?
Use nativeBounds and nativeScale to determine the size to set for your framebuffer or drawable. (Don't hard core the size.)
For GPU-heavy, performance-sensitive work — games with OpenGL ES or Metal — you really want to minimize the number of pixels going through the fragment shader. One good way to do that is to not render more pixels than the display hardware has.
I can now confirm that on a real device, correct rendering is produced when using the virtual resolution of 2208x1242 reported by [UIScreen bounds].

Dimensions for Mac app?

I've developed some iPhone apps before, but I focus mostly on design. When designing in Photoshop, the dimensions are easy for the iPhone: 320x480 and 640x960. However, I'm trying to find documentation on dimensions for Mac AppStore. I'm not sure if there are any dimension requirements, since there are many different Mac screen sizes. What guidelines should I follow for designing? Any resources?
Unless there's a really good reason for your app to work at a single size, you should make it resizeable. You should make sure that it at least works well on a screen size as small as 1440x900, and making it fit on the 11" MacBook Air's 1366x768 screen shouldn't be too hard for most apps. If your app is likely to be used in a multitasking scenario, you should make sure that it works with less than half the width of the screen.
Apple's Human Interface Guidelines specify that Mac OS X supports screens with resolution as low as 800 x 600 pixels. It also says that the display could be rotated for a minimum of 600 x 800 instead. Their advice is to optimize your application for 1024 x 768 pixels, but be resizable for any situation possible.

will my apps work on iphone OS4?

Screen resolution has increased in iphone OS4. Since lot of UI stuff have hardcoded co-ordinates, will my app run properly on OS4? I still haven't got Snow Leopard, so cant test run the simulator for OS4.
It is publicly known that the number of points vs pixels is 2:1 so point 320 has 640 pixels in hi-res and 320 pixels in low-res. Low resolution images will be somewhat jaggy, but their positioning on the screen would remain the same.

Resources