We had some related questions lately, so you might find them useful:
I can't tell you how the named applications do it, since I don't have access to the code, but painting onto a 3d model could be achieved as follows:
When you click the "paint" button, you cast a ray from the camera position into your 3d scene. For perspective projections, the direction depends on the mouse's screen position. You can look into my answer to this question to get an idea of how this is done.
Now perform a collision check of the ray and your model to find the affected triangle/triangles and vertices. Calculate the Barycentric coordinates where the ray hits the affected triangle. Use them to interpolate the texture coordinates of the intersection point. From the model data, you should know, which texture is used at the target location.
Now you know where you want to paint in your models' texture. How to proceed depends on what you want to paint. In case you just want to paint a pixel, you have to overwrite the texture's pixel at this location. You can do this either on the CPU or on the GPU using the rendering pipeline.
If you don't understand some things I mentioned yet, read the links I provided and continue learning OpenGL. Things will get clearer as soon as you know the rendering pipeline and get used to working with textures. If something is still not clear after that, feel free to ask.