fix the glViewport problem

add glViewport(0,0, cube_tex_size, cube_tex_size) before rendering to
texture.