
separate (adagate.drawisland)

procedure drawSeaweed is
begin

-- draw seaweed begin ------------------------------------------------

	wsort(wfar2near, nwx,pwx,nwz,pwz, xeye,zeye, avgdist);

	glUseProgram(pidpalm37); --palmTexShadID);
	glUniformMatrix4fv(imvp37, 1, GL_FALSE, imvp(1,1)'address);
	glUniform1i(flev37, foglev); --14dec17
	glUniform1i(fcol37, fogclr); --14dec17
	glUniform1i(samp37, 0);
	glUniform1i(dark37, darkness);
	glUniform1f(time37, glfloat(currentTime) ); 
	--shader makes them sway

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	glBindTexture(GL_TEXTURE_2D, tgrass_texid);

	-- note that the depthmask trick used for trees
	-- seems unnecessary here.
	for i in nwrng loop

		j:=wfar2near(i);
		pid := j + npalms;

		glUniform3f(icen37, 
			0.5*glfloat(pwx(j)+nwx(j)), 
			0.5*glfloat(pwy(j)+nwy(j)), 
			0.5*glfloat(pwz(j)+nwz(j)) );

		glUniform3f(irad37,
			0.5*glfloat(pwx(j)-nwx(j)), 
			0.5*glfloat(pwy(j)-nwy(j)), 
			0.5*glfloat(pwz(j)-nwz(j)) );

		glUniform1f(base37, weedbase(j) );

		glUniform1i(trid37, glint(pid) );
		xtreeobj.Draw( seaweed, vertbuff,uvbuff,elembuff);

	end loop; --i

-- draw seaweed end ------------------------------------------------


end drawSeaweed;


