
separate (adagate.drawroom)


procedure drawlev1 is
begin

---------- begin piranha --------------------------------------------

	gluseprogram(pidfish11); --=================================

	--portal-exterior discard:
	glUniform1i(side11, glint(numport) );

	glUniform3f(ieye11, glfloat(xeye),glfloat(yeye),glfloat(zeye));



	glUniform3f(lprt11, glfloat(xtgt1),glfloat(ytgt1),glfloat(ztgt1) ); 
	glUniform3f(rprt11, glfloat(xtgt2),glfloat(ytgt2),glfloat(ztgt2) ); 

	gluniformmatrix4fv(imvp11, 1, gl_false, mvp(1,1)'address );
	gluniform1i(samp11,0);
	glUniform3f(icen11, glfloat(fishx),glfloat(fishy),glfloat(fishz) );
	glUniform1f(irad11, glfloat(fishr) ); --swim circle radius
	glUniform1f(svel11, glfloat(fishs) ); --swim speed
	glUniform1f(wvel11, 1.0 ); --wiggle speed
	glUniform1f(wamp11, 1.0 ); --wiggle amplitude
	gluniform1i(arot11,1); -- 1=>CW,  -1=>CCW (28jan17)
	glbindtexture(gl_texture_2d, pfish_texid);

	glUniform1f(time11, glfloat(currentTime) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

	glUniform1f(time11, glfloat(currentTime+6.0) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

	glUniform1f(time11, glfloat(currentTime+12.0) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

	glUniform1f(time11, glfloat(currentTime+18.0) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

	glUniform1f(time11, glfloat(currentTime+24.0) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

	glUniform1f(time11, glfloat(currentTime+30.0) ); 
	myfish.draw( pdfish, vertbuff,uvbuff,elembuff ); --piranha

---------- end piranha ------------------------------------------------


	-- fancy frag shader draws normal water in level 1
	glUseProgram( pidpool12 ); --===================================

	glUniform1i(side12, glint(numport) );

	glUniform3f(ieye12, glfloat(xeye),glfloat(yeye),glfloat(zeye));

	glUniform3f(lprt12,glfloat(xtgt1),glfloat(ytgt1),glfloat(ztgt1)); 
	glUniform3f(rprt12,glfloat(xtgt2),glfloat(ytgt2),glfloat(ztgt2)); 

	gluniformmatrix4fv( imvp12, 1, gl_false, mvp(1,1)'address );
	gluniform1f(time12, glfloat(currentTime) );
	gluniform3f(icen12,glfloat(xpcen),glfloat(ypcen),glfloat(zpcen));
	gluniform3f(irad12,glfloat(xprad),glfloat(yprad),glfloat(zprad));
	gluniform1f(wlev12, glfloat(waterlevel) );
	rectsurf.draw(rso,vertbuff);



	--PalmTreeWindmill
	glUseProgram( pidpic03 ); --=====================================

	glUniform1i(side03, glint(numport) );

	glUniform3f(ieye03, glfloat(xeye),glfloat(yeye),glfloat(zeye));

	glUniform3f(lprt03,glfloat(xtgt1),glfloat(ytgt1),glfloat(ztgt1)); 
	glUniform3f(rprt03,glfloat(xtgt2),glfloat(ytgt2),glfloat(ztgt2)); 


	gluniformmatrix4fv( imvp03, 1, gl_false, mvp(1,1)'address );
	gluniform1f(time03, glfloat(currentTime) );
	gluniform2f(icen03, glfloat(x1picx), glfloat(x1picy) );
	gluniform2f(irad03, glfloat(x1picw/2.0), glfloat(x1pich/2.0) );
	gluniform2f(ires03, glfloat(winwidth), glfloat(winheight) );
	rectxobj.draw(pox,vertbuff,elembuff);


end drawlev1;

