How can i wrap the earth image around a 3D Sphere using OpenGL, GLFW, GLAD, GLM? Please help me out with this thing and currently i am a little more than a beginner so please tell me in that context. i don't need any obsolete methods for creating this like using GLUT or GLEW.can you just tell me its algorithm to create the outline of it(like using icosphere or triangles) and how and where in the whole program do i implement this algorithm. currently i am referring the "learnopengl.com" tutorials.i know how to create triangles and 3d rotational cube.
I'm not going to post proper working code here just giving you a guideline. There might be an easier way but what I did back in my days was to create a sphere using Triangle Strips. There is an icosahedron approach as well but I haven't looked into that.

So first of all look up on GL_TRIANGLE_STRIPS and how they work. Secondly you need to look up on Spherical coordinates and how to convert them to Cartesian Coordinates.

A brief overview is that Spherical coordinates have parameters (radius, zenith, azimuth). Radius is pretty much self explanatory. Zenith angle is the inclination angle from the pole of the sphere (lines of longitude) While the Azimuth angle runs along the latitude. Zenith runs from 0-PI (assuming 0 starts from 1 pole and PI is the second pole) or -PI/2 - PI/2 (assuming the extreme at both poles and 0 is the center) and Azimuth from 0-2PI (all the way around the sphere).

Now after that you can think of the sphere forming up from concentric Rings. At each fraction of the Zenith angle there is ring that runs around the sphere (the latitude lines). Then you create triangle strips between those rings to fill the sphere up.

So basically you want something like,

zenith = azimuth = 0
ring_increment = PI/num_rings;
sector_inrement = 2PI/num_sectors;

for(i=0; i &lt; PI; i+= ring_increment)
{
    for(j=0; j &lt; 2PI; j+= sector_increment)
    {
        vertex_list.add(convertToCartesianCoord(radius, zenith, azimuth))
        zenith += ring_increment
        vertex_list.add(convertToCartesianCoord(radius, zenith, azimuth))
        zenith -= ring_increment
    }
}


The more the number of rings and the number of sectors the smoother the sphere will be.