iphone - How to render 2 different objects with different textures? -
i using opengl es glkitbaseeffect. started rendering single 3d mesh single texture. every fine , dandy. added second base effect (for 2nd texture) can render 2nd 3d mesh.
i cant seem working.
i think problem misunderstanding way vbo vertex , index buffers sent gpu.
i call following twice (one per texture file):
// apply buffers... glgenbuffers(1, &_vertexbufferframeborder); glbindbuffer(gl_array_buffer, _vertexbufferframeborder); glbufferdata(gl_array_buffer, sizeof(meshdata), meshdata, gl_static_draw); glgenbuffers(1, &_indexbufferframeborder); glbindbuffer(gl_element_array_buffer, _indexbufferframeborder); glbufferdata(gl_element_array_buffer, sizeof(meshindices), meshindices, gl_static_draw); // position glenablevertexattribarray(glkvertexattribposition); glvertexattribpointer(glkvertexattribposition, 3, gl_float, gl_false, sizeof(vertexdata), buffer_offset(0)); // normal glenablevertexattribarray(glkvertexattribnormal); glvertexattribpointer(glkvertexattribnormal, 3, gl_float, gl_false, sizeof(vertexdata), buffer_offset(12)); // texture glenablevertexattribarray(glkvertexattribtexcoord0); glvertexattribpointer(glkvertexattribtexcoord0, 2, gl_float, gl_false, sizeof(vertexdata), (char *)24); // set frame texture uiimage *frameimage = [uiimage imagenamed:@"polaroid.png"]; self.framebordereffect.texture2d0.name = [imageloader loadglktextureinfo_byimage:frameimage];
man, have show answer problem here: how can apply different textures different objects using glkit?
i shared source code in here: http://download.csdn.net/detail/luozhonglan/7211993
Comments
Post a Comment