Modern OpenGL : Draw a sphere and cylinder

前端 未结 2 931
-上瘾入骨i
-上瘾入骨i 2021-02-06 19:24

I\'ve learned how to draw a cube using OpenGL from various tutorials.

For a cube, we consider each face to be composed of two triangles, and then appropriately set up th

2条回答
  •  Happy的楠姐
    2021-02-06 20:02

    For cylinders, it is convenient to work in cylindrical coordinates: (angle, radius, height). You will compute two polygons (constant angle increment, fixed radius, two height values) and create: two sets of triangles for the basis and a set of rectangles (split in two) for the lateral surface.

    For spheres, you will use spherical coordinates: (inclination, elevation, radius). By varying the two angles (one at a time), you will describe parallels and meridians on the sphere. These define a meshing, such that every tile is a quadrilateral (except at the poles); split along a diagonal to get triangles.

提交回复
热议问题