Yes, this basically.
For the benefit of the OP: there are a number of places where code to draw objects might run slow. These include:
(1) Sending drawing commands from the CPU to the GPU.
(2) Transforming vertices.
(3) Shading fragments.
In the case of glBegin/glEnd code, you’re going to be slow on number (1) here: sending drawing commands from the CPU to the GPU. There are a number of reasons for this, including that a huge number of OpenGL calls are needed, that a large number of primitives (i.e. triangles, quads, fans, strips, etc) are specified, and that data must be re-sent to the GPU each frame, whether it changes or not.
In worst case scenarios a program could completely bottleneck on these commands, so that you never see any performance, even if you’ve otherwise got the fastest GPU money can buy. This is one reason why, for example, older games might not run faster on new GPUs.
OpenGL provides a few ways to fix this. Older versions of OpenGL (1.1) provided vertex arrays, which allowed objects to be drawn with very few commands: a handful of commands to set up data sources, then a single command to draw, and maybe a handful more to switch everything off when done. In extreme cases, the overhead to draw an object might change from tens or hundreds of thousands of OpenGL calls to no more than 20 or so.
Using this approach we still have the bottleneck where all of the data must be sent and re-sent from the CPU to the GPU each frame, even if it doesn’t change. So a slightly less old version of OpenGL (1.5) introduced buffer objects, of which the first type was the vertex buffer object, which allowed vertex data to stay resident on the GPU (and gave you more control over when in the frame data that needs to change gets sent).
All of this is a total re-write of your drawing code, and is not something that I or anybody else can easily guide you through over the course of a few forum responses. You need to go looking for tutorials, in other words. If you have difficulties with them, then some more specific and focussed questions would be something we could help with.