Im trying to create a cube map of six jpg files from the web in GLKit. It works great on my iPhone 6+ but when i run the same code on "The new iPad" the cube map is just black when applied to an object. If i try the same thing with png files it works. Is there anything specific that needs to be done to load jpg's correctly on certain hardware?
The error from cubeMapWithContentsOfFiles is nil so it appears like GLKit thinks it loaded the texture properly.
Here is a demo project http://s.swic.name/Yw8F
If the dimensions of textures you're generating are themselves determined by the device's display dimensions (e.g. rendering a full-screen UIView to a texture) then the resulting cube-map could easily fall within the MAX_TEXTURE_SIZE on some devices but exceed it on larger devices. What are the pixel dimensions of your cube map on iPhone 6 Plus vs iPad 4th generation? If they exceed 4096 in either dimension you could be in trouble.
Related
I have been developing an app for iPad and was testing i on iPad 3 and iPad air with no problems at all. When i tried same app on iPad 2 the images were blur and some of them were not displaying properly even some were half visible half not visible.
As per my knowing the iOS7 only apps do not need non-retina graphics so i am using only Retina Graphics. So i tried using Asset Catalog too but same was the result.
Strangely when i use image#2x.png in xib it displays fine but do not show image in xib and when i use image.png it is displayed in xib but same issue when run on the device.
What i need to do to show images in xib too and would run fine on device?
Fisrt You MUST provide non-retina graphics in the asset catalog. You should understand that bigger images on old devices provides bigger memory and performance impacts.
You must pay attention also on odd measure, because if some geometric frames calculation results in decimal point such as 23.5 1.5 you are going to have antialiased elements in your interfaces.
You can avoid that wrapping frames into CGRectIntegral.
I have created a basic tilemap using Tiled. I am using JSTileMap with SpriteKit to get the map in the scene. As I understood, JSTileMap (rather SKTexture) handles the retina and different devices automatically. I have not been able to produce good results so far, here is my setup:
I have one .tmx file created at a base resolution using map.png as it's tile set. The .tmx is present in the project but I purposely did not add map.png (I do not want to support non-retina iPhones).
In the project I only added the following .png's:
map#2x~iphone.png (retina iPhones, using 48x48 tiles)
map~ipad.png (non-retina iPads, using 48x48 tiles)
map#2x~ipad.png (retina iPads, using 96x96 tiles)
Here are the results I get (after clean builds and reset content and settings on simulator):
Retina iPhone - tiles is wrong spots
iPad - no tilemap displayed, JSTileMap has parsing error
Retina iPad - tiles in wrong spots
If I use just a plain vanilla map.png (with 48x48 tiles):
Retina iPhone - tile map displays well but too large of course
iPad - tile map displays perfectly
Retina iPad - tile map display perfectly and is scaled.
I know I could just use a 24x24 tile map.png and apparently it will scale everything. I would prefer not to use scaled tile sets as the quality would suffer.
Thanks in advance.
E
I was able to narrow down that SKTexture ignores the ~ipad file extension for the #2x file extension. This only created more headaches in trying to build a tile map system for iPhone retina, iPad, and iPad retina.
I have decided to avoid the problem all together. I am not using a universal app in my project now. I have a iPhone project and a separate iPad Project. This way all I need to do to work with Retina is the #2x file extension in each project.
This does fully work (much easier). A word to the wise to those only building for retina iPhones... half your tile height and width sizes in the .tmx files, otherwise you will have a great time trying to deal with the content scaling.
Since you're using Sprite Kit and that requires iOS 7 there's actually no non-Retina iPhone to target anyway.
The thing in that instance is that you can't use #2x suffixed images without providing the same image without the #2x suffix. So the solution may be as simple as supplying the Retina iPhone images without the #2x suffix. You likely don't even need the ~iphone suffix either because the other two types of assets will only be used by the iPad devices.
This is based on an answer to a different question. I haven't personally verified it.
I am a Cocos2d game developer. I am developing a game using retina display images.
I have created texture files with and without HD suffix using zwoptex.
I have added those zwoptex plist texture files in app-delegate like [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:#"Background.plist"];
I have enabled the retina display to YES [director enableRetinaDisplay:YES];.
I have used the png files from the plist wherever i want using ccsprite *background = [CCSprite spriteWithSpriteFrameName:#"sample.png"];.
All those png files which I have included are high resolution images with both sizes 960*640 and 480 * 320. But in no reason the images look blurry and fuzzy when i run the game in simulator or iPhone. Anyone please help me to solve this issue …..
(The following image was posted as an example in a comment.)
cocos2d applies anti-aliasing to sprites by default. You need to turn that off:
[background.texture setAliasTexParameters];
hope this helps.
The screenshot you posted (I took the liberty of adding it to your question) shows that it was taken from the iPhone Simulator and not the iPhone (Retina) Simulator. Therefore it will not use the HD images.
With the iPhone Simulator running go to the Hardware -> Device menu and select iPhone (Retina) as the device. Then restart your app.
Note also that the iPhone Simulator will only render the game with a color depth of 16-Bit, regardless of settings in cocos2d or your Mac. The iOS Simulator renderer is limited to 16-Bit rendering for performance reasons (it only uses software rendering, no hardware acceleration). Only by looking at the game on an actual device can you make judgement calls about image quality.
To test whether the game is actually loading the HD assets or for some reason just loads the SD images, try running it without the SD images. If the game tries to load the SD images it will cause an error. If not, it is loading the HD images and the "blur issue" has a different cause. You could also log which files are loaded by adding a NSLog statement to the CCFileUtil class method fullPathFromRelativePath which performs the file name changes to load -hd images whenever possible.
You'll find that even miniscule amount of scaling or rotation applied to a sprite may have it look blurred, so check if you happen to do that. Any change in blend modes (using ccBlendFunc) could also cause blurred images. Also check that your images are fully opaque (opacity == 255).
Kind of a fun question. I am hoping that is generates a lot of good thinking.
I am in the design, early alpha stage of my current orthogonal game project. I am experimenting with different tile sizes. A few questions as I would like to step off on the right foot.
Should we differentiate tile size (80x80, 32x32 etc) on retina vs. non retina displays, iPhone vs iPad displays?
What is a good recommended tile size that accommodates both the designer and the artist... and why?
Goals:
I would like to a clean, crisp visuals no matter the display format. Cartoony, colorful 16bit to 32bit images no matter the display.
I would like to keep to a 1024x1024 texture size for my atlas. I am hoping this will give me enough tiles to make the world look good and not crush my tile map system.
My current map size is 200 tiles wide x 120 tiles high. The map will be a a low detail (nautically focused) mercator projection of Earth.
Thanks in advance for all the good advice.
E
I usually try to make my games for iPad screen aspect where I'm making sure that the important elements are in a smaller Safe Zone. And the UI can be anchored on specified distance from the edges. Then for iPhone screen aspect I crop a small portion of the screen and layout the UI accordingly.
So if you are working in landscape here are the sizes you need to support:
480x320 - iPhone (0.5)
960x640 - iPhone Retina (1)
1024x768 - iPad (1)
2048x1736 - iPad Retina (2)
The number in brackets indicate the scale. I just like picking iPad (1024x768) for my ingame units. At this point I have all textures in 3 sizes, since I'm using OpenGL I use different mipmaps for each resolution I need. My texture loading function can skip mipmap levels so that on devices that I don't need high res I safe memory and loading time.
Depends if you need to click on individual tiles. In case you need to I'll suggest using 64x64 on iPhone (480x320) 256x256 on iPad Retina (2048x1736). Having all your art in power of 2 is always good. If the size is too large then consider 48x48 for iPhone and 192x192 for iPad Retina. If your game requires you can have smaller tiles but consider having larger active zone around the entities that you have to click (hopefully not every tile will be clickable).
I faced a similar issue a while ago and realized I was tackling the problem from the wrong angle.
You first need to consider the average finger/thumb size of the user and determine how many pixels/points consume that space.
From there you can derive the non-Retina Display pixel units and Retina Display point units to use.
N.B. that a game that might play well on the iPad might not work on the iPhone if the user's fingers obscure the view.
I'm developing an iPad 2 app which will overlay panoramic views on top of physical space using Cinder.
The panorama images are about 12900x4000 pixels; they are being loaded from the web.
Right now the line to load the image is:
mGhostTexture = gl::Texture( loadImage( loadUrl( "XXX.jpg" ) ) );
Works fine for small images (e.g. 500x500). Not so well for full images (the rendered texture becomes a large white box).
I assume I'm hitting a size limit. Does anyone know a way to render or split up large images in openGL and/or Cinder?
for OpenGL ES 2.0:
"The maximum 2D or cube map texture size is 2048 x 2048. This is also the maximum renderbuffer size and viewport size."1
also, seems a solution may be present here:
Using libpng to "split" an image into segments