PDA

View Full Version : trying to draw a texture with a special sin function



Ramiro
05-18-2012, 08:13 AM
Hello openGl comunity, I have a question to draw a 2D texture over a image.
Im trying to reproduce the following effect:

wave_amp
wave_length
wave_phase


Defines the amplitude, frequency, speed, and phase of the wave effect. A raster scroll effect is achieved by using a sinusoidal function to draw the sprite with each line's horizontal position slightly different from the last.

wave_amp is the wave amplitude and wave_length is the wave frequency, and each is specified by a number of pixels.

I made a image to leave it cleaner on how The effect is supposed to be something like this:

http://s2.subirimagenes.com/imagen/previo/thump_7705166wave-description.png (http://www.subirimagenes.com/imagen-wavedescription-7705166.html)

I have an idea on using segments of gl quads blocks, but I gess if there is a better way to do it:



for (int parts = 0; parts < size; pats++)
glBegin(GL_QUADS);
// DrawPart i code;
glEnd();


Thanks for the help.