Using cocos2dx 3.0
Add this source part on the end of the HelloWorld::init() (HelloWorld.cpp) method.
batchNode = SpriteBatchNode::create("schlenzi2-900x640.jpg");
this->addChild(batchNode, -4);
Sprite *background;
background = Sprite::createWithTexture(batchNode->getTexture(), Rect(0, 0, 900, 640));
this->addChild(background, 3);
background->setAnchorPoint(Point::ZERO);
background->setPosition(Point(0,0));
Here the example Picture too (but I think it works also not with other 900x640)
//removed ….
bg-900x640_50percent.jpg (62.1 KB)
error.png (8.3 KB)
error.jpg (29.0 KB)
Get the same results with a PNG?
Yes.
Maybe it is an important hint:
The whole picture has also the size 900x640.
So the SpriteBatchNode too.
Thas the debug output:
OpenGL version = 4.2.12422 Compatibility Profile Context 13.152.0.0
Ready for GLSL
Ready for OpenGL 2.0
cocos2d.x.version: 3.0-alpha0
cocos2d.x.compiled_with_profiler: false
cocos2d.x.compiled_with_gl_state_cache: true
gl.vendor: ATI Technologies Inc.
gl.renderer: AMD Radeon HD 7700 Series
gl.version: 4.2.12422 Compatibility Profile Context 13.152.0.0
gl.max_texture_size: 16384
gl.max_texture_units: 32
gl.supports_ETC1: false
gl.supports_S3TC: true
gl.supports_ATITC: false
gl.supports_PVRTC: false
gl.supports_NPOT: true
gl.supports_BGRA8888: false
gl.supports_discard_framebuffer: false
gl.supports_vertex_array_object: true
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
cocos2d: padding: 0,0,0,0
Here are some screenshots (50% smaller):
original:
Error