Pulsating Objects

What is a simple function to make an object pulsate?

what about glscale?
just a guess

yes, glScale will work. But i was told to use a sine function to implement the pulsating. That is where i am lost

Using a sine wave would be a good solution. You could have the size of your object ‘pulsate’ between big and small by doing something like:

int size = originalsize+sin(2PIcurtime/frequency)*amplitude;
glScalef(size,size,size);

where curtime is a variable that is increased every frame. the other variables can just be constants that you think look good. Also you could do something similar to this that affects the alpha value and enable blending so that when the object gets smaller it fades for example

Hey thanks, I actually just figured out something like that. A little lost on the fading bit though. It sounds cool. Could you explain that some more? Thanx

the sine function returns values between -1 and 1
so you do not add the original size and do not multiply by amplitude but therefor map the values to 0 to 1 (only for the color not for your scaling)
(sin(2PIcurtime/frequency)+1)/2
and this value is set to the alpha value using glcolor4f

did i get it right tempocrew?