powervr sgx - Rotate Object OpenGL ES 2.0 -
we using following code plot bmp image in opengl es 2.0: (x1,y1 lower left coordinates, , x2,y2 top right coordinates of objects on screen, tempimage data pointer bmp image information stored)
struct { gluint uiid; gluint uilowerleftloc; gluint uiscalematrixloc; gluint auiloc[enumuniforms]; } m_shaderprogram; gluniform2f(m_shaderprogram.uilowerleftloc, x1, y1); float afmatrix[4] = { x2 - x1, 0, 0, y2 - y1 }; gluniformmatrix2fv(m_shaderprogram.uiscalematrixloc, 1, gl_false, afmatrix); glbindtexture(gl_texture_2d, m_uitexforeground); glteximage2d(gl_texture_2d, 0,gl_rgb, width, height, 0, gl_rgb, gl_unsigned_byte, tempimagedata); glbindbuffer(gl_array_buffer, m_uivbo); glenablevertexattribarray(vertex_array); glvertexattribpointer(vertex_array, 2, gl_float, gl_false, 0, 0); gldrawarrays(gl_triangle_strip, 0, 4); gldisablevertexattribarray(vertex_array);
i want rotate object in terms of angles. how can achieved ?
you should send rotation/transfom-matrix shader you're using before rendering mesh. within vertex shader, multiply coordinates matrix.
this site understanding basics of rendering matrices (it uses c++ , glm): http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/
Comments
Post a Comment