How to map texture along vertices?

Hi all,

Updating my project from processing to OpenFrameworks. Iā€™m having some trouble with masking a bitmap/texture in oF. I would like to achieve this:

Yeah not really good at drawing :slight_smile:

It should mask the image/texture along the vertices of the water.

The code in processing:

  
for(int j = 0; j < particles.length-1; j++)   
		{  
			  
			if(j==0)  
			{  
				beginShape();  
				texture(waterImg);  
				tint(255,255,255,100);  
			}  
			  
			vertex(particles[j].fXPos, particles[j].fYPos, particles[j].fXPos, particles[j].fYPos);  
			vertex(particles[j+1].fXPos, particles[j+1].fYPos, particles[j+1].fXPos, particles[j+1].fYPos);  
			  
			if(j==particles.length-2)  
			{  
				vertex(particles[particles.length-1].fXPos, height, particles[particles.length-1].fXPos, height);   
				vertex(particles[0].fXPos, height, particles[0].fXPos, height);   
				endShape();  
				tint(255,255,255,255);  
			}  
		}		  

I tried glTexCoord, glVertex but I failed to get it right.
Please some help here thanks

Remco

1 Like