Now how can i send the RGBA value , normal value and XYZ value of each vertex to vertex shader? I need the GLSL code and C++code in OpenGL.
Are gl_Vertex and gl_Normal the build-in variables in GLSL, and they represent XYZ value and normal value of each vertex?

Now how can i send the RGBA value , normal value and XYZ value of each vertex to vertex shader? I need the GLSL code and C++code in OpenGL.

If you use the a compatibility profile (the default), you can send your data to the shaders using that same C++ code. You just need to compile/link/bind/setup your shader program first. The way your providing triangles to the GPU isn't very efficient mind you (very CPU heavy), but it'll work.

As to the GLSL source, this isn't a code writing service. You can find this all over the net. Just websearch gl_Vertex, gl_Normal, etc. and you'll come up with many copy/paste examples.

Are gl_Vertex and gl_Normal the build-in variables in GLSL, and they represent XYZ value and normal value of each vertex?

Yes. These contain exactly what you pass in for vertex attributes, with whatever conversions you request when you provide them to the shader.

Thank you! The GLSL worked . Would you tell me an efficient way to provide triangles to the GPU?

Main thing is to set a performance target. Once you're fast enough, you can stop. And profiling is the key. You need to identify what your primary bottleneck is first. The CPU + GPU are a deeply pipelined system, and if you're optimizing something you're not bound on, then you could get absolutely no speed-up to show for your efforts.

Are your batches largely static (same values to glVertex/glNormal/glColor/etc. for each glBegin/glEnd pair) or dynamic? How much total data do you have in batch data altogether -- KB, MB, GB, unbounded? Do you have a lot of repeated drawing of the same objects in different places (instancing)? And how much have you done with GLSL shaders?

Re static and dynamic, it can pay dividends to handle these differently. For the static case, you just want to pre-upload the data to the GPU and then repeatedly launch batches from there as efficiently as possible (more below). For the dynamic case (or an unbounded amount of batch data), you need a method you can stream data to the GPU efficiently, and reuse it from there when possible (until it needs kicked off for some reason).

Just to give you a starter list, here are some things you might look into:

You can move on from there later if/when needed (geometry instancing, batch streaming, etc.). Also these optimizations focus on batch data; there are lots of others for other aspects of GPU rendering.

A warning: VBOs can be tricky. If applied nievely (one VBO per batch, many small batches) you can kill efficiency and your performance will be worse than client arrays. The trick in my experience is either using NVidia bindless and/or group your batches into shared VBOs, whether static or streaming.