OUTPUT BUFFER:
# drawf.tcl # # An example of the OpenGL red book modified to work with Tcl3D. # The original C sources are Copyright (c) 1993-2003, Silicon Graphics, Inc. # The Tcl3D sources are Copyright (c) 2005, Paul Obermeier. # See file LICENSE for complete license information. # # Draws the bitmapped letter F on the screen (several times). # This demonstrates use of the glBitmap() call. package require tcl3d 0.4.0 set rasters { 0xc0 0x00 0xc0 0x00 0xc0 0x00 0xc0 0x00 0xc0 0x00 0xff 0x00 0xff 0x00 0xc0 0x00 0xc0 0x00 0xc0 0x00 0xff 0xc0 0xff 0xc0} # Font to be used in the Tk listbox. set listFont {-family {Courier} -size 10} # Show errors occuring in the Togl callbacks. proc bgerror { msg } { tk_messageBox -icon error -type ok -message "Error: $msg\n\n$::errorInfo" exit } # 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 CreateCallback { toglwin } { glPixelStorei GL_UNPACK_ALIGNMENT 1 glClearColor 0.0 0.0 0.0 0.0 } proc DisplayCallback { toglwin } { glClear GL_COLOR_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] glColor3f 1.0 1.0 1.0 glRasterPos2i 20 20 glBitmap 10 12 0.0 0.0 11.0 0.0 $::rasters glBitmap 10 12 0.0 0.0 11.0 0.0 $::rasters glBitmap 10 12 0.0 0.0 11.0 0.0 $::rasters glFlush } proc ReshapeCallback { toglwin { w -1 } { h -1 } } { set w [$toglwin width] set h [$toglwin height] glViewport 0 0 $w $h glMatrixMode GL_PROJECTION glLoadIdentity glOrtho 0 $w 0 $h -1.0 1.0 glMatrixMode GL_MODELVIEW } frame .fr pack .fr -expand 1 -fill both togl .fr.toglwin -width 400 -height 400 -double false \ -createproc CreateCallback \ -reshapeproc ReshapeCallback \ -displayproc DisplayCallback listbox .fr.usage -font $::listFont -height 1 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: OpenGL Red Book example drawf" bind .