global string $tempGroup; global string $com; global int $vTarget; global int $vCount; global proc oGL_example() { glBegin("GL_QUADS"); glVertex3f(0,0,0); glVertex3f(5,0,0); glVertex3f(5,0,5); glVertex3f(0,0,5); glEnd(); } global proc glBegin(string $which) { global string $tempGroup; global string $com; global int $vTarget; global int $vCount = 0; $tempGroup = `group -em`; $com = "polyCreateFacet "; $vTarget = 3; if ($which == "GL_TRIANGLES") { $vTarget = 3; print "\nMaking Triangles\n"; } else if ($which == "GL_QUADS") { $vTarget = 4; print "\nMaking Quads\n"; } else { $vTarget = -1; } } global proc glVertex3f(float $x, float $y, float $z) { global string $com; global int $vTarget; global int $vCount; global string $tempGroup; $com += (" -p " + $x + " " + $y + " " + $z + " "); $vCount++; if (($vTarget != -1) && ($vCount == $vTarget)) { string $temp[] = `eval($com)`; parent $temp[0] $tempGroup; $vCount = 0; $com = "polyCreateFacet "; } } global proc glEnd() { global string $com; global string $tempGroup; global int $vTarget; if ($vTarget == -1) { eval($com); } else { string $temp[] = `polyUnite -ch 0 $tempGroup`; // select all of the vertices PolySelectConvert 3; polyMergeVertex -d 0.001 -ch 0; select -r $temp[0]; } }