   Subdividing quad
  I'm working on an assignment which requires us to apply a heightmap. Before doing so, however, we have to subdivide a sphere which has me confused.Currently, I procedurally generate the vertexes and store them in an array of type Vertex (which is a class that contains various members  - i.e. x, y, z, u, v, normals for each vertex). In my draw code, I draw these points out as quads (as opposed to triangles, I suppose).There are two ways I can think of implementing the subdivision. The first, and seemingly easier method, is to increase the stacks and slices and regenerate the sphere data.The second way would be to draw each quad out as a grid of quads (e.g. with a subdivision level of 10, I'd draw 100 quads in each actual quad of the sphere).I'm thinking (although not sure), the first way probably wouldn't be acceptable and that the second method is what is expected of us.The confusion arises, however, in how to go about actually calculating the points for the grid. For a 2D quad, it's very simple however the confusion arises when wanting to do so in 3D space with each quad basically being on a different plane than the one before it.Any ideas on how to approach this?   
  Hi,In subdivision, one simply divides the polygons up into smaller ones.  Usually, this is to better approximate a complex surface, so the appropriate next step would be moving the vertices to fit that surface.  Subdividing just divides the polygons; it doesn't do anything special to move the divided points.  That's just the usual next step.Now, to do that next step.  You're doing a sphere, which is easy.  Say your sphere's origin is point "A" and its radius is "r".  Every vertex you draw ought to be "r" units away from "A".  Now, if you subdivide, the vertices you've just created will be closer than they should be to "A".  To fix this, find the vector "v" from your vertex to "A".  The new location of the vertex is equal to A+r*v/||v||.  Essentially, you normalize "v", then scale it by the radius "r", and add it to the center "A".  -G   ;  Hmm, I'm a bit confused. When would we actually add that extra vertex? And wouldn't adding an extra point to each surface only subdivide it by 4?To further elaborate, we're meant to be able to change the subdivision level at run time. So, let's say we procedurally generate at start up and store the vertexes for a sphere with 10 stacks and slices and we draw it with no subdivision. This sphere would have 100 polygons.Now, the assignment says that users should be able to tessellate the sphere by pressing a button, but since mine is built using quads, I believe the equivalent would be subdivision.So, if the user presses 's' for example, I will the subdivide each quad by 4, for example. If the presses 's' again, this will double to 8, 16 and so on.I can create the sphere and view it perfectly. There are no issues with this. The issues arise when it comes to pressing 's' and showing the subdivision.This is what I was getting at. If the subdivision level is 0, each vertex from the generated sphere is read in and the sphere is drawn using quads (using glBegin(GL_QUADS)). In this example, a single quad, viewed on the XY plane with appear as:---------|.......||.......||.......||.......|---------When the user then presses 's', each quad will be drawn as four quads, below:---------|...|...||___|___||...|...||...|...|---------Now, we're going to applying a heightmap to this sphere, which, to my understanding, is the reason why we would have to subdivide each quad.EDIT: Okay, the font isn't monotype, so the diagrams aren't going to show up correctly, but I think the point gets across.   