Rotating model in openGL 2 in iOS -


i'm working opengl on ios , android, i'm trying draw model, sphere, set camera/eye coords inside sphere, set texture , enable panning , zoom achieve 360 degree effect, made android using opengl 1.0, having lot of problems in ios, made using opengl 2.0, set , working, i'm having problem panning, in order rotate model view matrix, i'm applying rotate transformation, works if change axis rotation, messes other 2 axis, @ end if apply rotation in both axis, x , y, sphere rotates if kind of transformation has been don in z axis, texture ends upside-down or being displayed in diagonal, i'm doing exact same transformations in android , don't have problem there, has experience issue? suggestion? clue? code? article? think when apply first transformation coords in space change , next transformation not being applied properly.

here's ios code :

- (void)glkview:(glkview *)view drawinrect:(cgrect)rect {     glclear(gl_color_buffer_bit);      glkmatrixstackpush(_obstack);      glkmatrixstackrotate(_obstack,                          glkmathdegreestoradians(_obanglex),                          0.0f, 1.0f, 0.0f);     glkmatrixstackrotate(_obstack,                          glkmathdegreestoradians(_obangley),                          1.0f, 0.0f, 0.0f);      glkmatrixstackscale(_obstack,                         _obscalefactor,                         _obscalefactor,                         _obscalefactor);      self.obeffect.transform.modelviewmatrix = glkmatrixstackgetmatrix4(_obstack);      // prepare effect     [self.obeffect preparetodraw];      // draw model     gldrawarrays(gl_triangles, 0, panoramavertices);      glkmatrixstackpop(_obstack);     self.obeffect.transform.modelviewmatrix = glkmatrixstackgetmatrix4(_obstack); } 

this android code :

public void ondrawframe(gl10 argl) {         argl.glclearcolor(0.0f, 0.0f, 0.0f, 1.0f);         argl.glclear(gl10.gl_color_buffer_bit | gl10.gl_depth_buffer_bit);         argl.glpushmatrix();          argl.glrotatef(obangley, 1.0f, 0.0f, 0.0f);         argl.glrotatef(obanglex, 0.0f, 1.0f, 0.0f);              argl.glscalef(obscalefactor, obscalefactor, obscalefactor);          if (obmodel != null) {             obmodel.draw(argl);         }         argl.glpopmatrix();     } 

i trying on , on again several implementations, every single time no success, @ end, went , implemented opengl 1.0 version ios , under scenario, whenever matrix being rotated, axis aren't, solution, implement opengl 1.0 version.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -