Dear All:

I use GLSL120

I draw a triangle mesh in OpenGL using this:

void RenderScene()

{

....

glBegin(GL_TRIANGLES);

for (int i = 0; i < faceNum; i++)

{

//Draw the first vertex

glNormal3f(nx1,ny1,nz1);

glColor4f(r1,g1,b1,a1);

glVertex3f(x1,y1,z1);

//Draw the second vertex

glNormal3f(nx2,ny2,nz2);

glColor4f(r2,g2,b2,a2);

glVertex3f(x2,y2,z2);

//Draw the third vertex

glNormal3f(nx3,ny3,nz3);

glColor4f(r3,g3,b3,a3);

glVertex3f(x3,y3,z3);

}

glEnd();

}

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?

Thanks a lot!