I’m using Cocos2d0-x 3.0 Beta 2
In my world Layer I have a method that draws directly using openGl
// Tell OpenGL this is the texture we're using GL::bindTexture2D(_subterraneanTexture->getName()); // wrap in both the S and T directions (that's X and Y for the rest of us!) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Enable the arrays GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORDS); _glProgram->use(); _glProgram->setUniformsForBuiltins(); // Give OpenGl our array of points that we want to fill glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(cocos2d::Point), _subterraneanFloorTextureTrianglePoints); // Give OpenGl the array of points in the texture we want to use to fill the above array of points glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORDS, 2, GL_FLOAT, GL_FALSE, sizeof(cocos2d::Point), _subterraneanFloorTexturePoints); // Tell OpenGl to draw the arrays we gave it glDrawArrays(GL_TRIANGLE_STRIP, 0, _numberOfFloorSubterraneanTextureTrianglePoints);
This is in a method that is called via
_customCommand.init(_globalZOrder); _customCommand.func = CC_CALLBACK_0(WorldLayer::drawSubterrains, this); Director::getInstance()->getRenderer()->addCommand(&_customCommand);
which is in the layer’s overridden draw() method.
This layer is added as a child to a layer (zoomlayer) as are most other sprites etc.
When I change the scale of the zoom layer, all of my assets scale appropriately, but the directly drawn stuff doesn’t.
Does anyone have a suggestion as to how I may be able to fix this?