Draw a line using OpenGL|ES in Android NDK using C++ -


i want draw line in android ndk app using opengl|es.

i using following code draw line on screen.

glfloat line[] = {                       0,0,0,                      100,100,0                   };  glfloat colors[] = {                         1.0f, 0.0f, 0.0f, 1.0f,                         0.0f, 1.0f, 0.0f, 1.0f,                         0.0f, 0.0f, 1.0f, 1.0f                     }; glclearcolor(0.0f, 0.0f, 0.0f, 0.0f); glclear(gl_color_buffer_bit); glshademodel(gl_smooth); glvertexpointer(3, gl_float, 0, line); glcolorpointer(4, gl_float, 0, colors); glenableclientstate(gl_vertex_array); glenableclientstate(gl_color_array); glclear(gl_color_buffer_bit); gldrawarrays(gl_lines, 0, 2); glflush(); 

the above code paint line on screen, issue facing if change coordinates in array line e.g.

glfloat line[] = {                       0,0,0,                       5,5,0                  }; 

then same line drawn on screen i.e. there no change in length of line. output attched: enter image description here

what reason abnormal behavior ?

without modifying matrices default opengl coordinates normalized (mapped 0-1). (0,0) center of screen, (1,0) center right side, (0, -1) bottom of screen, etc.

in example (5,5) , (100,100) in same direction relative center , offscreen why see same line in both.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -