Controling an object

Say that I’ve 5 quad object.How do I manipulate each object, like when I press an A key the third object will change it color. Can anyone help me?

In the example you suggest, you would respond to the keystroke by calling glColor before the third object is rendered. Something like this:

glPushAttrib(GL_CURRENT_BIT);
glColor3*(r, g, b);
RenderObject(3);
glPopAttrib();

How you make this happen in response to the keystroke depends on the system you are using (X, win32, GLUT, etc), and the way your scene rendering code is organized.

HTH G.

Can u explain a little depth. I’m using GLUT to make this program. What this program does actually like this :

I’m rendering a keyboard object that each object represent a key on the keyboard (I hope u got the idea).

When the user press a key on the keyboard say an E key the object that represent the key will change it color and when the user lift up the key the object state will return to the previous color.

Can anyone give an idea.

You mean how do you catch the key press/release?

glutKeyboardFunc();
glutKeyboardUpFunc();