
separate (adagate.drawisland)

procedure drawWeeds is
begin

-- draw sandweed begin ------------------------------------------------

	ssort(sfar2near, nsx,psx,nsz,psz, 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);
	glBindTexture(GL_TEXTURE_2D, cgrass_texid);

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

		j:=sfar2near(i);
		pid := j + npalms + nseaweed;

		glUniform3f(icen37, 
			0.5*glfloat(psx(j)+nsx(j)), 
			0.5*glfloat(psy(j)+nsy(j)), 
			0.5*glfloat(psz(j)+nsz(j)) );

		glUniform3f(irad37,
			0.5*glfloat(psx(j)-nsx(j)), 
			0.5*glfloat(psy(j)-nsy(j)), 
			0.5*glfloat(psz(j)-nsz(j)) );

		glUniform1f(base37, seedbase(j) );

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

	end loop; --i

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


end drawWeeds;


