no display name and no $DISPLAY environment variable
    while executing
"load /enadisk/commun/linux/local/ActiveTcl-8.6.11/lib/libtk8.6.so Tk"
    ("package ifneeded Tk 8.6.11" script)
    invoked from within
"load /commun/linux/local/ActiveTcl-8.6.11/lib/Img1.4.6/libtkimgwindow1.4.6.so"
    ("package ifneeded img::window 1.4.6" script)
    invoked from within
"package require img::window"
    ("package ifneeded Img 1.4.6" script)
    invoked from within
"package require Img"
    (in namespace eval "::request" script line 14)
    invoked from within
"namespace eval ::request $script"
    ("::try" body line 12)

OUTPUT BUFFER:

# Lesson16.tcl # # Chris Aliotta & NeHe's Fog Tutorial # # This Code Was Created By Christopher Aliotta & Jeff Molofee 2000 # A HUGE Thanks To Fredric Echols For Cleaning Up # And Optimizing This Code, Making It More Flexible! # If You've Found This Code Useful, Please Let Me Know. # Visit My Site At nehe.gamedev.net # # Modified for Tcl3D by Paul Obermeier 2006/01/25 # See www.tcl3d.org for the Tcl3D extension. package require Img package require tcl3d 0.5.0 # Font to be used in the Tk listbox. set gDemo(listFont) {-family {Courier} -size 10} # Determine the directory of this script. set gDemo(scriptDir) [file dirname [info script]] # Display mode. set gDemo(fullScreen) false # Window size. set gDemo(winWidth) 640 set gDemo(winHeight) 480 set gDemo(light) false ; # Lighting ON/OFF set gDemo(xrot) 0.0 ; # X Rotation set gDemo(yrot) 0.0 ; # Y Rotation set gDemo(xspeed) 0.5 ; # X Rotation Speed set gDemo(yspeed) 0.5 ; # Y Rotation Speed set gDemo(z) -5.0 ; # Depth Into The Screen set gDemo(lightAmbient) { 0.5 0.5 0.5 1.0 } set gDemo(lightDiffuse) { 1.0 1.0 1.0 1.0 } set gDemo(lightPos) { 0.0 0.0 2.0 1.0 } set gDemo(filter) -1 ; # Which Filter To Use set gDemo(texture) [tcl3dVector GLuint 3] ; # Storage For 3 Textures set gDemo(fogMode) [list $::GL_EXP $::GL_EXP2 $::GL_LINEAR] ; # Storage For Three Types Of Fog set gDemo(fogNames) [list "GL_EXP" "GL_EXP2" "GL_LINEAR"] set gDemo(fogFilter) 0 ; # Which Fog Mode To Use set gDemo(fogColor) {0.5 0.5 0.5 1.0} ; # Fog Color # Show errors occuring in the Togl callbacks. proc bgerror { msg } { tk_messageBox -icon error -type ok -message "Error: $msg\n\n$::errorInfo" ExitProg } # Print info message into widget a the bottom of the window. proc PrintInfo { msg } { if { [winfo exists .fr.info] } { .fr.info configure -text $msg } } proc SetFullScreenMode { win } { set sh [winfo screenheight $win] set sw [winfo screenwidth $win] wm minsize $win $sw $sh wm maxsize $win $sw $sh set fmtStr [format "%dx%d+0+0" $sw $sh] wm geometry $win $fmtStr wm overrideredirect $win 1 focus -force $win } proc SetWindowMode { win w h } { set sh [winfo screenheight $win] set sw [winfo screenwidth $win] wm minsize $win 10 10 wm maxsize $win $sw $sh set fmtStr [format "%dx%d+0+25" $w $h] wm geometry $win $fmtStr wm overrideredirect $win 0 focus -force $win } # Toggle between windowing and fullscreen mode. proc ToggleWindowMode {} { if { $::gDemo(fullScreen) } { SetFullScreenMode . set ::gDemo(fullScreen) false } else { SetWindowMode . $::gDemo(winWidth) $::gDemo(winHeight) set ::gDemo(fullScreen) true } } # Toggle lighting on or off. proc ToggleLighting {} { set ::gDemo(light) [expr ! $::gDemo(light)] if { $::gDemo(light) } { glEnable GL_LIGHTING } else { glDisable GL_LIGHTING } .fr.toglwin postredisplay } # Toggle between the different texture filters. proc ToggleFilter {} { incr ::gDemo(filter) if { $::gDemo(filter) > 2 } { set ::gDemo(filter) 0 } .fr.toglwin postredisplay } # Toggle between the different fog filters. (NEW) proc ToggleFogFilter {} { incr ::gDemo(fogFilter) if { $::gDemo(fogFilter) > 2 } { set ::gDemo(fogFilter) 0 } glFogi GL_FOG_MODE [lindex $::gDemo(fogMode) $::gDemo(fogFilter)] ; # Fog Mode set filterName [lindex $::gDemo(fogNames) $::gDemo(fogFilter)] PrintInfo [format "Fog %s\n%s" $filterName $::glInfo] .fr.toglwin postredisplay } # Set the rotation speed in X. proc SetXSpeed { val } { set ::gDemo(xspeed) [expr $::gDemo(xspeed) + $val] } # Set the rotation speed in Y. proc SetYSpeed { val } { set ::gDemo(yspeed) [expr $::gDemo(yspeed) + $val] } # Set the depth. proc SetDepth { val } { set ::gDemo(z) [expr $::gDemo(z) + $val] .fr.toglwin postredisplay } proc LoadGLTextures {} { # Load texture image. set texName [file join $::gDemo(scriptDir) "Data" "Crate.bmp"] set retVal [catch {set phImg [image create photo -file $texName]} err1] if { $retVal != 0 } { error "Error reading image $texName ($err1)" } else { set w [image width $phImg] set h [image height $phImg] set n [tcl3dPhotoChans $phImg] set TextureImage [tcl3dVectorFromPhoto $phImg] image delete $phImg } if { $n == 3 } { set type $::GL_RGB } else { set type $::GL_RGBA } glGenTextures 3 $::gDemo(texture) ; # Create Three Textures # Create Nearest Filtered Texture glBindTexture GL_TEXTURE_2D [$::gDemo(texture) get 0] glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER $::GL_NEAREST glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER $::GL_NEAREST glTexImage2D GL_TEXTURE_2D 0 $n $w $h 0 $type GL_UNSIGNED_BYTE $TextureImage # Create Linear Filtered Texture glBindTexture GL_TEXTURE_2D [$::gDemo(texture) get 1] glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER $::GL_LINEAR glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER $::GL_LINEAR glTexImage2D GL_TEXTURE_2D 0 $n $w $h 0 $type GL_UNSIGNED_BYTE $TextureImage # Create MipMapped Texture glBindTexture GL_TEXTURE_2D [$::gDemo(texture) get 2] glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER $::GL_LINEAR glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER $::GL_LINEAR_MIPMAP_NEAREST glTexImage2D GL_TEXTURE_2D 0 $n $w $h 0 $type GL_UNSIGNED_BYTE $TextureImage gluBuild2DMipmaps GL_TEXTURE_2D $n $w $h $type GL_UNSIGNED_BYTE $TextureImage $TextureImage delete ; # Free The Texture Image Memory } # Resize And Initialize The GL Window proc ReshapeCallback { toglwin { w -1 } { h -1 } } { set w [$toglwin width] set h [$toglwin height] glViewport 0 0 $w $h ; # Reset The Current Viewport glMatrixMode GL_PROJECTION ; # Select The Projection Matrix glLoadIdentity ; # Reset The Projection Matrix # Calculate The Aspect Ratio Of The Window gluPerspective 45.0 [expr double($w)/double($h)] 0.1 100.0 glMatrixMode GL_MODELVIEW ; # Select The Modelview Matrix glLoadIdentity ; # Reset The Modelview Matrix set ::gDemo(winWidth) $w set ::gDemo(winHeight) $h } # All Setup For OpenGL Goes Here proc CreateCallback { toglwin } { LoadGLTextures ; # Jump To Texture Loading Routine glEnable GL_TEXTURE_2D ; # Enable Texture Mapping glShadeModel GL_SMOOTH ; # Enable Smooth Shading glClearColor 0.5 0.5 0.5 1.0 ; # We'll Clear To The Color Of The Fog glClearDepth 1.0 ; # Depth Buffer Setup glEnable GL_DEPTH_TEST ; # Enables Depth Testing glDepthFunc GL_LEQUAL ; # The Type Of Depth Testing To Do glHint GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST ; # Really Nice Perspective Calculations glLightfv GL_LIGHT1 GL_AMBIENT $::gDemo(lightAmbient) ; # Setup The Ambient Light glLightfv GL_LIGHT1 GL_DIFFUSE $::gDemo(lightDiffuse) ; # Setup The Diffuse Light glLightfv GL_LIGHT1 GL_POSITION $::gDemo(lightPos) ; # Position The Light glEnable GL_LIGHT1 ; # Enable Light One glFogi GL_FOG_MODE [lindex $::gDemo(fogMode) $::gDemo(fogFilter)] ; # Fog Mode glFogfv GL_FOG_COLOR $::gDemo(fogColor) ; # Set Fog Color glFogf GL_FOG_DENSITY 0.35 ; # How Dense Will The Fog Be glHint GL_FOG_HINT GL_DONT_CARE ; # Fog Hint Value glFogf GL_FOG_START 1.0 ; # Fog Start Depth glFogf GL_FOG_END 5.0 ; # Fog End Depth glEnable GL_FOG } proc Animate {} { .fr.toglwin postredisplay set ::animateId [tcl3dAfterIdle Animate] } proc StartAnimation {} { if { ! [info exists ::animateId] } { Animate } } proc StopAnimation {} { if { [info exists ::animateId] } { after cancel $::animateId unset ::animateId } } # Here's Where We Do All The Drawing proc DisplayCallback { toglwin } { # Clear Screen And Depth Buffer glClear [expr $::GL_COLOR_BUFFER_BIT | $::GL_DEPTH_BUFFER_BIT] # Viewport command is not really needed, but has been inserted for # Mac OSX. Presentation framework (Tk) does not send a reshape event, # when switching from one demo to another. glViewport 0 0 [$toglwin width] [$toglwin height] glLoadIdentity ; # Reset The Current Modelview Matrix glTranslatef 0.0 0.0 $::gDemo(z) glRotatef $::gDemo(xrot) 1.0 0.0 0.0 glRotatef $::gDemo(yrot) 0.0 1.0 0.0 glBindTexture GL_TEXTURE_2D [$::gDemo(texture) get $::gDemo(filter)] glBegin GL_QUADS # Front Face glNormal3f 0.0 0.0 1.0 glTexCoord2f 0.0 0.0 ; glVertex3f -1.0 -1.0 1.0 ; glTexCoord2f 1.0 0.0 ; glVertex3f 1.0 -1.0 1.0 ; glTexCoord2f 1.0 1.0 ; glVertex3f 1.0 1.0 1.0 ; glTexCoord2f 0.0 1.0 ; glVertex3f -1.0 1.0 1.0 ; # Back Face glNormal3f 0.0 0.0 -1.0 glTexCoord2f 1.0 0.0 ; glVertex3f -1.0 -1.0 -1.0 ; glTexCoord2f 1.0 1.0 ; glVertex3f -1.0 1.0 -1.0 ; glTexCoord2f 0.0 1.0 ; glVertex3f 1.0 1.0 -1.0 ; glTexCoord2f 0.0 0.0 ; glVertex3f 1.0 -1.0 -1.0 ; # Top Face glNormal3f 0.0 1.0 0.0 glTexCoord2f 0.0 1.0 ; glVertex3f -1.0 1.0 -1.0 ; glTexCoord2f 0.0 0.0 ; glVertex3f -1.0 1.0 1.0 ; glTexCoord2f 1.0 0.0 ; glVertex3f 1.0 1.0 1.0 ; glTexCoord2f 1.0 1.0 ; glVertex3f 1.0 1.0 -1.0 ; # Bottom Face glNormal3f 0.0 -1.0 0.0 glTexCoord2f 1.0 1.0 ; glVertex3f -1.0 -1.0 -1.0 ; glTexCoord2f 0.0 1.0 ; glVertex3f 1.0 -1.0 -1.0 ; glTexCoord2f 0.0 0.0 ; glVertex3f 1.0 -1.0 1.0 ; glTexCoord2f 1.0 0.0 ; glVertex3f -1.0 -1.0 1.0 ; # Right face glNormal3f 1.0 0.0 0.0 glTexCoord2f 1.0 0.0 ; glVertex3f 1.0 -1.0 -1.0 ; glTexCoord2f 1.0 1.0 ; glVertex3f 1.0 1.0 -1.0 ; glTexCoord2f 0.0 1.0 ; glVertex3f 1.0 1.0 1.0 ; glTexCoord2f 0.0 0.0 ; glVertex3f 1.0 -1.0 1.0 ; # Left Face glNormal3f -1.0 0.0 0.0 glTexCoord2f 0.0 0.0 ; glVertex3f -1.0 -1.0 -1.0 ; glTexCoord2f 1.0 0.0 ; glVertex3f -1.0 -1.0 1.0 ; glTexCoord2f 1.0 1.0 ; glVertex3f -1.0 1.0 1.0 ; glTexCoord2f 0.0 1.0 ; glVertex3f -1.0 1.0 -1.0 ; glEnd if { [info exists ::animateId] } { set ::gDemo(xrot) [expr $::gDemo(xrot) + $::gDemo(xspeed)] set ::gDemo(yrot) [expr $::gDemo(yrot) + $::gDemo(yspeed)] } $toglwin swapbuffers } # Put all exit related code here. proc ExitProg {} { exit } # Create the OpenGL window and some Tk helper widgets. proc CreateWindow {} { frame .fr pack .fr -expand 1 -fill both # Create Our OpenGL Window togl .fr.toglwin -width $::gDemo(winWidth) -height $::gDemo(winHeight) \ -swapinterval 1 \ -double true -depth true \ -createproc CreateCallback \ -reshapeproc ReshapeCallback \ -displayproc DisplayCallback listbox .fr.usage -font $::gDemo(listFont) -height 9 label .fr.info grid .fr.toglwin -row 0 -column 0 -sticky news grid .fr.usage -row 1 -column 0 -sticky news grid .fr.info -row 2 -column 0 -sticky news grid rowconfigure .fr 0 -weight 1 grid columnconfigure .fr 0 -weight 1 wm title . "Tcl3D demo: Chris Aliotta & NeHe's Fog Tutorial (Lesson 16)" # Watch For ESC Key And Quit Messages wm protocol . WM_DELETE_WINDOW "ExitProg" bind . "ExitProg" bind . "ToggleWindowMode" bind . "ToggleLighting" bind . "ToggleFilter" bind . "ToggleFogFilter" bind . "SetXSpeed -0.01" bind . "SetXSpeed 0.01" bind . "SetYSpeed -0.01" bind . "SetYSpeed 0.01" bind . "SetDepth 0.05" bind . "SetDepth -0.05" bind .fr.toglwin <1> "StartAnimation" bind .fr.toglwin <2> "StopAnimation" bind .fr.toglwin <3> "StopAnimation" bind .fr.toglwin "StopAnimation" .fr.usage insert end "Key-Escape Exit" .fr.usage insert end "Key-F1 Toggle window mode" .fr.usage insert end "Key-l Toggle lighting" .fr.usage insert end "Key-f Toggle texture filter" .fr.usage insert end "Key-g Toggle fog filter" .fr.usage insert end "Key-Up|Down Decrease|Increase x rotation speed" .fr.usage insert end "Key-Left|Right Decrease|Increase y rotation speed" .fr.usage insert end "Key-d|i Decrease|Increase distance" .fr.usage insert end "Mouse-L|MR Start|Stop animation" .fr.usage configure -state disabled } CreateWindow set glInfo [format "Running on %s with a %s (OpenGL %s, Tcl %s)" \ $tcl_platform(os) [glGetString GL_RENDERER] \ [glGetString GL_VERSION] [info patchlevel]] ToggleFilter ToggleFogFilter if { [file tail [info script]] == [file tail $::argv0] } { # If started directly from tclsh or wish, then start animation. update StartAnimation }