How to draw a sphere in OpenGL ES 2 correctly -
i wondering difference between gldrawarrays
, gldrawelements
is? use , when? question have how draw sphere android. have 360 points on perimeter circle, mean need 360 * 360 coordinates sphere? seems expensive, there has better way. way can think of far doing nested loops. that's going processor time. way can think of drawing , rotating 360 degrees in direction. it's not true sphere, rotated circle.
"i wondering difference between gldrawarrays , gldrawelements is?"
gldrawarrays used when deal directly stream of vertices, , gldrawelements used when use index buffer, adds layer of indirection , lets reference vertices index number. can check out article more info on gldrawelements (disclaimer: wrote article): http://www.learnopengles.com/android-lesson-eight-an-introduction-to-index-buffer-objects-ibos/
the opengl es manual has info these 2 functions:
http://www.khronos.org/opengles/sdk/docs/man/xhtml/gldrawarrays.xml http://www.khronos.org/opengles/sdk/docs/man/xhtml/gldrawelements.xml
"another question have how draw sphere android."
you have break down triangles. 1 simple way of doing tesselating sphere using latitude , longitude, lines on globe. can use loop sin , cos generate points.
these 2 questions on stack overflow have example code should straightforward adapt android:
Comments
Post a Comment