#!/usr/bin
set pothome /mnt/dd3/ebook/tech/opengl/pot
source /mnt/dd3/ebook/tech/opengl/pot/tkheader.h
tk_bisque
wm geometry . 600x300$winX$winY
##############################################################################
# The following procedure creates a screen for chapter 6 of the tutorial.

wm title . "Chapter6 - Blending, Antialiasing, Fog"
. configure -background white
createframe .c6menubar 2 
# call procedure createframe and create a frame for the menus available
# in chapter5. we call this menu frame .c6menubar and give it a width
# of 2 units.
   
createtextwidget "-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1" blue white 0 0 nw


menubutton .c6menubar.menu -text "Concepts" -underline 0 \
-menu .c6menubar.menu.conceptMenu

# next we create a menubutton in this frame (.c6menubar) and call it
# .c6menubar.menu.  We also assign it some text - Concepts and 
# underline the letter C.

set m [	menu .c6menubar.menu.conceptMenu ]
# create a concept menu on the menubar .c6menubar.menu and add options to it

$m add separator
$m add cascade -label "1 - Blending" -menu $m.blendingMenu
set m1 [ menu $m.blendingMenu]
$m1 add command -label "1.1 - Introduction"\
                -command { catch { exec kill $pid }
                killprocess c6Process	
	        displaytext "$pothome/CHAP6/TEXT_FILES/BlendIntro.txt"
                greentag .textdisplay 1.0 2.55
                redtag .textdisplay 4.0 4.55
                bluetag .textdisplay 15.0 15.55
}
$m1 add separator
$m1 add command -label "1.2 - Combining Color Values"\
	        -command { catch { exec kill $pid }
                killprocess c6Process	
	        displaytext "$pothome/CHAP6/TEXT_FILES/CombineColor.txt"
                greentag .textdisplay 1.0 1.55
                redtag .textdisplay 3.0 3.55
                bluetag .textdisplay 29.0 29.55
}
$m1 add separator
$m1 add command -label "1.3 - Blending - When , Why?"\
	        -command { catch { exec kill $pid }
                killprocess c6Process	
	        displaytext "$pothome/CHAP6/TEXT_FILES/WhenWhy.txt"
                greentag .textdisplay 1.0 2.55
                redtag .textdisplay 4.0 4.55
}
$m1 add separator
$m1 add command -label "1.4 - A Simple Example"\
                -command { catch { exec kill $pid }
                killprocess c6Process	
                set pid [exec $pothome/CHAP6/PROG_FILES/alpha.tk &]
                procfile $pid c6Process
                
	        displaytext "$pothome/CHAP6/TEXT_FILES/alpha.txt"
                greentag .textdisplay 1.0 1.55
                redtag .textdisplay 3.0 3.55
                bluetag .textdisplay 6.0 6.55
                bluetag .textdisplay 19.0 20.55
                bluetag .textdisplay 31.0 31.55
}
$m1 add separator
$m1 add command -label "1.5 - 3D - Blending - I"\
                -command { catch { exec kill $pid }
                killprocess c6Process	
                 set pid [exec $pothome/CHAP6/PROG_FILES/alpha2.tk &]      
	         procfile $pid c6Process
                 displaytext "$pothome/CHAP6/TEXT_FILES/alpha2.txt"
                 greentag .textdisplay 1.0 2.55
                 redtag .textdisplay 4.0 4.55
                 bluetag .textdisplay 6.0 6.55
                 bluetag .textdisplay 11.0 11.55
                 
}
$m1 add separator
$m1 add command -label "1.6 - 3D - Blending - II"\
                -command { catch { exec kill $pid }
                killprocess c6Process	
                 set pid [exec $pothome/CHAP6/PROG_FILES/alpha3D.tk &]      
	        procfile $pid c6Process
                 displaytext "$pothome/CHAP6/TEXT_FILES/alpha3D.txt"
                 greentag .textdisplay 1.0 3.55
                 redtag .textdisplay 5.0 5.55
                 bluetag .textdisplay 7.0 7.55
                 bluetag .textdisplay 15.0 15.55
                 bluetag .textdisplay 26.0 26.55
                 functag .textdisplay 39.0 39.14
                 functag .textdisplay 39.18 39.26
}

$m add separator



$m add cascade -label "2 - Antialiasing" -menu $m.antialiaseMenu
set m2 [ menu $m.antialiaseMenu ]
$m2 add command -label "2.1 - Introduction" \
		-command { catch {exec kill $pid}
                killprocess c6Process	
                set pid [ exec $pothome/CHAP6/PROG_FILES/Antialiase &]
	        procfile $pid c6Process
                displaytext "$pothome/CHAP6/TEXT_FILES/AntialiaseIntro.txt" 
                greentag .textdisplay 1.0 2.55
                redtag .textdisplay 4.0 4.55
                bluetag .textdisplay 6.0 6.55
                bluetag .textdisplay 24.0 24.55
                functag .textdisplay 29.0 29.55
}
$m2 add separator
$m2 add command -label "2.2 - AntiAliase-RGB Mode" \
		-command { catch {exec kill $pid}
                killprocess c6Process	
                set pid [exec $pothome/CHAP6/PROG_FILES/aargb.tk &]
	        procfile $pid c6Process
                displaytext "$pothome/CHAP6/TEXT_FILES/aargb.txt"
                greentag .textdisplay 1.0 3.55
                redtag .textdisplay 5.0 5.55
                bluetag .textdisplay 8.0 8.55
 
 }
$m2 add separator

$m2 add command -label "2.3 - Antialiasing Polygons"\
	-command {catch {exec kill $pid}
                killprocess c6Process	
        set pid [exec $pothome/CHAP6/PROG_FILES/aapoly.tk &]
        procfile $pid c6Process
        displaytext "$pothome/CHAP6/TEXT_FILES/aapoly.txt"
        greentag .textdisplay 1.0 3.55
        redtag .textdisplay 5.0 5.55
        bluetag .textdisplay 8.0 8.55 
        functag .textdisplay 21.6 21.23
        functag .textdisplay 21.27 21.37
        functag .textdisplay 35.24 35.50
        functag .textdisplay 40.29 40.43
        functag .textdisplay 41.11 41.19
        bluetag .textdisplay 27.0 27.55
        functag .textdisplay 45.34 45.46
        functag .textdisplay 46.5 46.14
        functag .textdisplay 46.34 46.40

        bluetag .textdisplay 55.0 55.55
        bluetag .textdisplay 61.0 61.55
        functag .textdisplay 64.0 64.10
        functag .textdisplay 64.32 64.53

}


$m add separator

$m add cascade -label "3 - Fog" -menu $m.fogMenu
set m3 [menu $m.fogMenu ]

$m3 add command -label "3.1 - Theory" \
	-command {catch {exec kill $pid}
                killprocess c6Process	
         displaytext "$pothome/CHAP6/TEXT_FILES/FogTheory.txt" 
        greentag .textdisplay 1.0 3.55
        redtag .textdisplay 5.0 5.55
        bluetag .textdisplay 8.0 8.55
        bluetag .textdisplay 26.0 26.55
        functag .textdisplay 28.46 28.52
        functag .textdisplay 29.3 29.13
        functag .textdisplay 31.26 31.34
        functag .textdisplay 32.4 32.15
}
$m3 add separator
$m3 add command  -label "3.2 - Fog Equations" \
        -command {catch {exec kill $pid}
                killprocess c6Process	
        displaytext "$pothome/CHAP6/TEXT_FILES/fogequations.txt"
        greentag .textdisplay 1.0 2.55
        redtag .textdisplay 4.0 4.55
        bluetag .textdisplay 7.0 7.55
        bluetag .textdisplay 14.0 14.55
        bluetag .textdisplay 31.0 31.55
        functag .textdisplay 25.19 25.27
        functag .textdisplay 33.0 33.55
        functag .textdisplay 38.12 38.23
        functag .textdisplay 39.0 39.40
        functag .textdisplay 41.12 41.26
        functag .textdisplay 41.28 41.40
        functag .textdisplay 42.0 42.10
        functag .textdisplay 45.27 45.39

}
$m3 add separator
$m3 add command  -label "3.3 - An Example" \
        -command {catch {exec kill $pid}
                killprocess c6Process	
         set pid [exec $pothome/CHAP6/PROG_FILES/fog.tk &]
        procfile $pid c6Process
        displaytext "$pothome/CHAP6/TEXT_FILES/fog.txt"

        greentag .textdisplay 1.0 2.55
        redtag .textdisplay 4.0 4.55
        bluetag .textdisplay 7.0 7.55
        bluetag .textdisplay 12.0 12.55
        functag .textdisplay 17.0 17.12
        functag .textdisplay 23.0 23.14
        functag .textdisplay 30.0 30.12
        functag .textdisplay 37.0 37.11
        functag .textdisplay 43.0 43.12

}

button .c6menubar.unpack -relief flat -text "Unpack" -underline 0 
		
button .c6menubar.pack -relief flat -text "Pack" -underline 0 
      
button .c6menubar.exit -relief flat -text "Exit" -underline 1 \
	-command {
		     catch { exec kill $pid }
		     catch { exec kill $pid1}
                killprocess c6Process	
                     catch { send main wm deiconify . }
		     exit}
pack .c6menubar.menu .c6menubar.unpack .c6menubar.pack .c6menubar.exit -side left

bind .c6menubar.unpack <1> {
set cwd [ pwd ]
cd $pothome/CHAP6/PROG_FILES
catch { exec make >& /dev/tty }
cd $cwd


}
bind .c6menubar.pack <1> {
set cwd [ pwd ]
cd $pothome/CHAP6/PROG_FILES
catch { exec make clean  >& /dev/tty }
cd $cwd
}

displaytext  "$pothome/CHAP6/Main.txt" 
greentag .textdisplay 1.0 1.55
redtag .textdisplay 3.0 3.55



#set $cmd {lappend pid_list [expr 1 * $pid]} 
#send Tutorial.tk {eval $cmd }
#send Tutorial.tk {lappend pid_list  [expr 1 * $pid] }
































































































