
separate (adagate.drawisland)


procedure drawMisc is


	procedure drawNose is --nose of LockheedElectra
	begin

	-- nose:
		glUseProgram(pidnose41);
		glUniformMatrix4fv(imvp41, 1, GL_FALSE, imvp(1,1)'address);
		glUniform1i(samp41, 0);
		glUniform1i(dark41, darkness);
		glUniform3f(icen41, glfloat(r4cxn),glfloat(r4cyn),glfloat(r4czn) );
		glUniform3f(irad41, glfloat(r4rxn),glfloat(r4ryn),glfloat(r4rzn) );
		glBindTexture(GL_TEXTURE_2D, nose_texid);
		ntexsurf.Draw(nose,vertbuff,uvbuff,elembuff);

	end drawNose;

	procedure drawCockpit is -- LockheedElectra
	begin

	-- cockpit:
		glUseProgram(pidcpit42);
		glUniformMatrix4fv(imvp42, 1, GL_FALSE, imvp(1,1)'address);
		glUniform1i(samp42, 0);
		glUniform1i(dark42, darkness);
		glUniform3f(icen42, glfloat(r4cx),glfloat(r4cy),glfloat(r4cz) );
		glUniform3f(irad42, glfloat(r4rx),glfloat(r4ry),glfloat(r4rz) );
		glBindTexture(GL_TEXTURE_2D, cpit_texid);
		ctexsurf.Draw(cpit,vertbuff,uvbuff,elembuff);

	end drawCockPit;


	procedure drawSign is -- wooden sign, SOS in sand, & ZPM receptacle
	begin

	-- draw some fixed textured objects using stargate shaders/program -------------
		-- draw old wooden sign in sand:
		glUseProgram(pidgate33);
		glUniformMatrix4fv(imvp33, 1, GL_FALSE, imvp(1,1)'address);
		glUniform1i(samp33,0);
		glUniform1i(dark33, darkness);
		glBindTexture(GL_TEXTURE_2D, gard_texid);
		pictobj.Draw(sign, vertbuff,uvbuff,elembuff);

		-- draw SOS at waters edge:
		glBindTexture(GL_TEXTURE_2D, sos_texid);
		pictobj.Draw(sos, vertbuff,uvbuff,elembuff);

	-- begin draw receptacle beneath ZPM:
		if  not mseated  then -- unlit receptacle
			glbindtexture(gl_texture_2d, gate0_texid);
		else -- lit receptacle
			glbindtexture(gl_texture_2d, gate_texid);
		end if;
		pictobj.draw( msokrcpt, vertbuff, uvbuff, elembuff );
	-- end draw receptacle beneath ZPM:

	end drawSign;


	procedure drawBurntLog is
	begin

		glUseProgram(pidlog39);
		glUniformMatrix4fv(imvp39, 1, GL_FALSE, imvp(1,1)'address);
		glUniform1i(samp39, 0);
		glUniform1i(dark39, darkness);
		-- burnt log
		glBindTexture(GL_TEXTURE_2D, log_texid);
		glUniform3f(icen39, glfloat(blcx),glfloat(blcy),glfloat(blcz) );
		glUniform3f(irad39, glfloat(blrx),glfloat(blry),glfloat(blrz) );
		stexsurf.Draw(item,vertbuff,uvbuff,elembuff); --primary piece

		glUniform3f(irad39, glfloat(blrz),glfloat(blry),glfloat(blrx) );
		stexsurf.Draw(item,vertbuff,uvbuff,elembuff); --perpendicular piece

	end drawBurntLog;


	procedure drawLeanTo is
	begin

		-- draw primitive lean-to here

		glUseProgram(pidlean38); --lean2TexShadID);

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

		glUniform1i(flev38, foglev); --14dec17
		glUniform1i(fcol38, fogclr); --14dec17
		glUniformMatrix4fv(imvp38, 1, GL_FALSE, imvp(1,1)'address);
		glUniform1i(samp38, 0);
		glUniform1i(dark38, darkness);

		glUniform3f(icen38, glfloat(l2xc),glfloat(l2yc),glfloat(l2zc) );
		glUniform3f(irad38, glfloat(l2xr),glfloat(l2yr),glfloat(l2zr) );

		glBindTexture(GL_TEXTURE_2D, lean2_texid);
		mylean2obj.Draw(lean2, vertbuff,uvbuff,elembuff);


	end drawLeanTo;


begin


	drawSign;

	drawNose;

	drawCockpit;

	drawBurntLog;

	drawLeanTo;



	-- draw crab/star,bones,jar

	glUseProgram(pidcrab40);
	glUniformMatrix4fv(imvp40, 1, GL_FALSE, imvp(1,1)'address);
	glUniform1i(samp40, 0);
	glUniform1i(dark40, darkness);


	-- fish bones
	glBindTexture(GL_TEXTURE_2D, fishbones_texid);
	glUniform3f(icen40, glfloat(fbcx),glfloat(fbcy),glfloat(fbcz) );
	glUniform3f(irad40, glfloat(fbrx),glfloat(fbry),glfloat(fbrz) );
	glUniform1f(angl40, glfloat(0.7*onepi) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);

	glUniform1f(angl40, glfloat(0.0*onepi) );
	glUniform3f(irad40, glfloat(fbrx),glfloat(fbry),glfloat(fbrz+0.03) );
	glUniform3f(icen40, glfloat(fbcx+0.05),glfloat(fbcy),glfloat(fbcz-0.05) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);


	-- human arm bone
	glBindTexture(GL_TEXTURE_2D, arm_texid);
	glUniform3f(icen40, glfloat(lgcx),glfloat(lgcy),glfloat(lgcz) );
	glUniform3f(irad40, glfloat(lgrx),glfloat(lgry),glfloat(lgrz) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);

	-- human skull.  Is it Amelia?
	glBindTexture(GL_TEXTURE_2D, skull_texid);
	glUniform3f(icen40, glfloat(skcx),glfloat(skcy),glfloat(skcz) );
	glUniform3f(irad40, glfloat(skrx),glfloat(skry),glfloat(skrz) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);

	-- draw bottle of freckle cream nearby
	glBindTexture(GL_TEXTURE_2D, frek_texid);
	glUniform3f(icen40, glfloat(fxc),glfloat(fyc),glfloat(fzc) );
	glUniform3f(irad40, glfloat(fxr),glfloat(fyr),glfloat(fzr) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);



	--//////// starfish, crab begin //////////////////////
	glBindTexture(GL_TEXTURE_2D, star_texid);
	glUniform3f(icen40, glfloat(s1cx),glfloat(s1cy),glfloat(s1cz) );
	glUniform3f(irad40, glfloat(s1rx),glfloat(s1ry),glfloat(s1rz) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);

	glBindTexture(GL_TEXTURE_2D, crab_texid);
	glUniform3f(icen40, glfloat(c1cx),glfloat(c1cy),glfloat(c1cz) );
	glUniform3f(irad40, glfloat(c1rx),glfloat(c1ry),glfloat(c1rz) );
	stexsurf.Draw(item,vertbuff,uvbuff,elembuff);
	--//////// starfish, crab end //////////////////////




--lean-to, crab, starfish, skull, bone, jar,
--fishbones, cockpit, nose, burntLog, SoS, sign

--plane, crab, bones, jar, sign, etc



end drawMisc;


