I am currently working on this tutorial http://www.raywenderlich.com/3888/how-to-create-a-game-like-tiny-wings-part-1 and trying to draw hills correctly. However, the tutorial was written before cocos 2.0, and therefore it does not include shaders. So, I'm trying to convert it. So far, I have not been able to get such images:



As you can see, he does not paint the hills completely, and the colors of the hills are also wrong. He also stops drawing them completely after 2 or 3 seconds. Here is a piece of code, I draw them.
- (void) draw { [self.shaderProgram use]; [self.shaderProgram setUniformForModelViewProjectionMatrix]; ccGLBlendFunc( CC_BLEND_SRC, CC_BLEND_DST ); ccGLBindTexture2D(_stripes.texture.name); glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, _hillVertices); glEnableVertexAttribArray(kCCVertexAttrib_Position); glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, _hillTexCoords); glEnableVertexAttribArray(kCCVertexAttrib_TexCoords); glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nHillVertices); }
If necessary, I can share more code. I hope someone had this problem before I can help or offer a solution.
thanks
source share