objective c - Can't draw completely using Open GL ES 2.0 in cocos 2d 2.0 in a game tutorial -
i working on tutorial http://www.raywenderlich.com/3888/how-to-create-a-game-like-tiny-wings-part-1 , trying hills correctly drawn. however, tutorial have been written before cocos 2.0 , therefore doesnt involve shaders. so, im trying convert it. far, have not succeeded , getting images these:



as can seen, doesn't draw hills , colors of hills wrong too. stops drawing them after 2 or 3 seconds. here part of code, 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 needed can share more of code. hoping have had problem before can me or suggest solution.
thanks
Comments
Post a Comment