iphone - How to flex a 3D texture with OpenGL ES? -
i have tried draw 3d squares (with opengl on iphone) , make them rotate around, sphere.
http://i618.photobucket.com/albums/tt265/loyalmoral/post/screenshot2013-05-15at23249pm.png
but square flat (the first 1 on image below), , want flex it:
http://i618.photobucket.com/albums/tt265/loyalmoral/post/untitled-1.jpg
someone told me have use glsl, don't know shading language.
this vertex , fragment (follow ray wenderlich's tutorial):
// vertex.glsl attribute vec4 position; attribute vec4 sourcecolor; varying vec4 destinationcolor; uniform mat4 projection; uniform mat4 modelview; attribute vec2 texcoordin; varying vec2 texcoordout; void main(void) { destinationcolor = sourcecolor; gl_position = projection * modelview * position; texcoordout = texcoordin; } // fragment.glsl varying lowp vec4 destinationcolor; varying lowp vec2 texcoordout; uniform sampler2d texture; void main(void) { gl_fragcolor = destinationcolor * texture2d(texture, texcoordout); }
could me? :)
instead of using quad (pair of triangles) square use grid it. able place vertices of grid manually resulting in shape want.
Comments
Post a Comment