Forums » C++ Framework » Sprites are blurred »
| Jiri Formanek | Sprites are blurred | ||||
|---|---|---|---|---|---|
|
Added by Jiri Formanek almost 2 years ago
Hello friends, I have a problem with rendering CCSprite sprite I tried find information about this, but I found only one suggestion for cocos2d-iphone - it's autoscale parameter of CCDirector::init() method. But there is no such parameter in cocos2d-x. Any suggestions? Thank you very much. Swap |
||||
| Zhe Wang | RE: Sprites are blurred | ||||
|
Added by Zhe Wang almost 2 years ago
cocos2d-x has its autoscale mechanism, and it's different between platforms. ( A little ugly, I admit, aha). Enjoy Coding, Enjoy Life. |
||||
| Jiri Formanek | RE: Sprites are blurred | ||||
|
Added by Jiri Formanek almost 2 years ago
Hello, I've added the test project (simple with 5 sprites) and two screenshots from the simulator. It is rather different that I wrote before, because now are blurred sprites in the center (the second image). Zoom the screenshot to perfect view of the defect. I was testing only on ios platform without retina display enabled. I used template from cocos2d-x. I am using XCode4. Swap blurred-sprites.zip - test project (348.8 kB) screen.tiff - example 1 (30.7 kB) screen2.tiff - example 2 (59.3 kB) |
||||
| Zhe Wang | RE: Sprites are blurred | ||||
|
Added by Zhe Wang almost 2 years ago
I am tracing this bug, but haven't resolved it. I use cocos2d-iphone 1.0.0-rc3. and translate your code to #define WIDTH 320 #define HEIGHT 480 CCSprite* sprite1 = [CCSprite spriteWithFile:@"something.png"]; sprite1.position = ccp(WIDTH/2, HEIGHT/2); [self addChild:sprite1]; CCSprite* sprite2 = [CCSprite spriteWithFile:@"something.png"]; sprite2.position = ccp(WIDTH/2,HEIGHT/4); [self addChild:sprite2]; CCSprite* sprite3 = [CCSprite spriteWithFile:@"something.png"]; sprite3.position = ccp(WIDTH/2,HEIGHT/4*3); [self addChild:sprite3]; CCSprite* sprite4 = [CCSprite spriteWithFile:@"something.png"]; sprite4.position = ccp(WIDTH/4,HEIGHT/2); [self addChild:sprite4]; CCSprite* sprite5 = [CCSprite spriteWithFile:@"something.png"]; sprite5.position = ccp(WIDTH/4*3, HEIGHT/4); [self addChild:sprite5]; No matter running on iphone3 simulator or ipad simulator, it looks the same as your tiff pictures. SpriteBlurred-iphone4.PNG (30.6 kB) Enjoy Coding, Enjoy Life. |
||||
| Jiri Formanek | RE: Sprites are blurred | ||||
|
Added by Jiri Formanek almost 2 years ago
Hello, do you have any solution to workaround the problem? I do not understand that anybody does not find the same problems before. The behaviour seems to be random :-( Thanks. Swap |
||||
| Zhe Wang | RE: Sprites are blurred | ||||
|
Added by Zhe Wang almost 2 years ago
Hi, Jiri, I just learn this from Riq.
This will work for you. Have a try! Enjoy Coding, Enjoy Life. |
||||
| Jiri Formanek | RE: Sprites are blurred | ||||
|
Added by Jiri Formanek almost 2 years ago
Hello, Swap |
||||
| Zhe Wang | RE: Sprites are blurred | ||||
|
Added by Zhe Wang almost 2 years ago
oops, Enjoy Coding, Enjoy Life. |
||||
| Zhe Wang | RE: Sprites are blurred | ||||
|
Added by Zhe Wang almost 2 years ago
One of my friend met the same problem, and he told me CCDirector::sharedDirector()->setProjection(kCCDirectorProjection2D) will fix this, while the default setting is kCCDirectorProjection3D. Enjoy Coding, Enjoy Life. |
||||
| Jiri Formanek | RE: Sprites are blurred | ||||
|
Added by Jiri Formanek almost 2 years ago
Hello, |
||||
| Laurens Rodriguez | RE: Sprites are blurred | ||||
|
Added by Laurens Rodriguez about 1 year ago
Hi, sorry to resuscitate this thread, but I think that CCDirector::sharedDirector()->setProjection(kCCDirectorProjection2D only works if the sprite in pixels are even? odd sizes give me blurred images. |
||||
| Steven J | RE: Sprites are blurred | ||||
|
Added by Steven J about 1 year ago
This is happening on HD for me. The fixes above may help, and try this: add 0.5 or some similar between-1-and-0 value. This is a known issue with the iPhone trying to render halfway between pixels, not just OpenGL. The iOS manuals may provide some help, but I don't think they'll provide much for you. In the meantime, try to figure out where/why it's doing the half-pixel thingy and adjust the scale/width/size |
(1-11/11)
