|
|
|
NAME
scene - Create and manipulate 3D scenes widgets
SYNOPSIS
STANDARD OPTIONS
- Command-Line Name: -borderwidth
- Database Name: borderWidth
- Database Class: BorderWidth
- Command-Line Name: -highlightthickness
- Database Name: highlightThickness
- Database Class: HighlightThickness
- Command-Line Name: -background
- Database Name: background
- Database Class: Background
See the options manual entry for detailed descriptions of the above options.
WIDGET-SPECIFIC OPTIONS
- Command-Line Name: -height
- Database Name: height
- Database Class: Height
- Specifies a desired window height that the scene widget should request
from its geometry manager. The value may be specified in any of the
forms acceptable to Tk_GetPixels(). Defaults to 320 pixels.
- Command-Line Name: -width
- Database Name: width
- Database Class: Width
- Specifies a desired window width that the scene widget should request
from its geometry manager. The value may be specified in any of the
forms acceptable to Tk_GetPixels(). Defaults to 320 pixels.
- Command-Line Name: -ident
- Database Name: ident
- Database Class: Ident
- Specifies a string value that may be used has a flag to identifiate this
window. Default to the empty string.
- Command-Line Name: -double
- Database Name: double
- Database Class: Double
-
Specifies a boolean value that indicates whether or not the user is asking
for a double buffered window. Defaults to true.
- Command-Line Name: -rgba
- Database Name: rgba
- Database Class: Rgba
-
Specifies a boolean value that indicates whether or not context is created in
RGBA mode. Dafaults to true.
- Command-Line Name: -depth
- Database Name: depth
- Database Class: Depth
-
Specifies a boolean value that indicates whether or not context is created
with depth buffer. Defaults to true.
- Command-Line Name: -orthographic
- Database Name: orthographic
- Database Class: Orthographic
-
Specifies a boolean value that indicates whether or not context used
orthographic projection. Defaults to false.
- Command-Line Name: -accum
- Database Name: accum
- Database Class: Accum
- Command-Line Name: -alpha
- Database Name: alpha
- Database Class: Alpha
-
Specifies a boolean value that indicates whether or not context supports
alpha. Defaults to false.
- Command-Line Name: -stencil
- Database Name: stencil
- Database Class: Stencil
-
Specifies a boolean value that indicates whether or not context supports
stencil. Defaults to false.
- Command-Line Name: -stencilsize
- Database Name: stencilsize
- Database Class: StencilSize
-
Specifies an integer value that indicates size of stencil channel, if stencil is
enabled. Defaults to 1.
- Command-Line Name: -redsize
- Database Name: redsize
- Database Class: RedSize
-
Specifies an integer value that indicates size of red channel. Defaults to 1.
- Command-Line Name: -greensize
- Database Name: greensize
- Database Class: GreenSize
-
Specifies an integer value that indicates size of green channel. Defaults to 1.
- Command-Line Name: -bluesize
- Database Name: bluesize
- Database Class: BlueSize
-
Specifies an integer value that indicates size of blue channel. Defaults to 1.
- Command-Line Name: -alphasize
- Database Name: alphasize
- Database Class: AlphaSize
-
Specifies an integer value that indicates size of alpha channel. Defaults to 1.
- Command-Line Name: -accumredsize
- Database Name: accumredsize
- Database Class: AccumRedSize
-
Specifies an integer value that indicates size of red accumulation channel. Defaults to 1.
- Command-Line Name: -accumgreensize
- Database Name: accumgreensize
- Database Class: AccumGreenSize
-
Specifies an integer value that indicates size of green accumulation channel. Defaults to 1.
- Command-Line Name: -accumbluesize
- Database Name: accumbluesize
- Database Class: AccumBlueSize
-
Specifies an integer value that indicates size of blue accumulation channel. Defaults to 1.
- Command-Line Name: -accumalphasize
- Database Name: accumalphasize
- Database Class: AccumAlphaSize
-
Specifies an integer value that indicates size of alpha accumulation channel. Defaults to 1.
- Command-Line Name: -depthsize
- Database Name: depthsize
- Database Class: DepthSize
-
Specifies an integer value that indicates size of depth buffer. Defaults to 1.
- Command-Line Name: -redraw
- Database Name: redraw
- Database Class: Redraw
-
Name of Tcl callback function to evaluate to render scene. If no callback
specified, defaults to rendering all compiled lists declared for this widget.
Those options are use to configure viewport:
- Command-Line Name: -left
- Database Name: left
- Database Class: Left
-
Specifies a double value that indicates left coordinate of intersection of
visible region with plane at depth 1.0. Default to -1.0.
- Command-Line Name: -right
- Database Name: right
- Database Class: Right
-
Specifies a double value that indicates right coordinate of intersection of
visible region with plane at depth 1.0. Default to 1.0.
- Command-Line Name: -bottom
- Database Name: bottom
- Database Class: Bottom
-
Specifies a double value that indicates bottom coordinate of intersection of
visible region with plane at depth 1.0. Default to -1.0.
- Command-Line Name: -top
- Database Name: top
- Database Class: Top
-
Specifies a double value that indicates top coordinate of intersection of
visible region with plane at depth 1.0. Default to 1.0.
- Command-Line Name: -near
- Database Name: near
- Database Class: Near
-
Specifies a double value that indicates distance of near face of the
visible cube. Any object placed before this plane will be clipped. Default to 0.01.
- Command-Line Name: -far
- Database Name: far
- Database Class: Far
-
Specifies a double value that indicates distance of far face of the
visible cube. Any object placed behind this plane will be
clipped. Default to 10.0.
INTRODUCTION
The scene command creates a new window (given by the pathName argument)
and makes it into a 3D scene renderer widget. Additional options,
described above, may be specified on the command line or in the
option database to configure aspects of the scene such as its colors
and 3-D relief. The scene command returns its pathName argument. At
the time this command is invoked, there must not exist a window named
pathName, but pathName's parent must exist.
Scene widgets implement a state machine, based on the OpenGL API.
WIDGET COMMAND
The scene command creates a new Tcl command whose name is
pathName. This command may be
used to invoke various operations on the widget. It has the
following general form:
pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command. The
following widget commands are possible for scene widgets:
cget,
configure,
version,
extensions,
begin,
end,
lbegin,
lend,
ldelete,
lcall,
vertex,
normal,
color,
material,
texture,
texmode,
fog,
translate,
scale,
rotate,
enable, and
disable.
cameramove,
camerarotate,
navigate,
render, and
dump,
- pathName cget
- Returns the current value of the configuration option given by
option. Option
may have any of the values accepted by the scene command.
- pathName configure
-
Query or modify the configuration options of the widget. If no option is
specified, returns a list describing all of the available options
for pathName (see Tk_ConfigureInfo for information on the format of
this list). If option is specified with no value, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
option is specified). If one or more option-value pairs are
specified, then the command modifies the given widget option(s) to
have the given value(s); in this case the command returns an empty
string. Option may have any of the values accepted by the scene
command.
- pathName version
- Returns version of OpenGL engine
- pathName extensions
- Returns list of extensions supported by OpenGL engine
- pathName begin mode
- This commands starts declaration of object. mode must be one of
points,lines,line_loop,line_strip,
triangles,triangle_strip,triangle_fan,
quads,quad_strip or polygon.
- pathName end
- Terminates current object
- pathName lbegin
- Starts a new compiled list. Returns the list Id.
- pathName lend
- Termintes current list.
- pathName ldelete
?listid listid ...?
- Delete compiled lists.
- pathName lcall
?listid listid ...?
- Call compiled lists.
- pathName vertex
- Add new vertex to object currently defined.
- pathName normal
- Defines normal for next vertices in object currently defined.
- pathName color colorvalue
- Defines color for next vertices in object currently defined.
- pathName material
?options ...?
- Defines material for next vertices in object currently defined. Valid
options are -side, -diffuse, -specular, -emission, -shininess,
-texture and -texcoords.
- pathName light
?lightid?
?options ...?
- Defines properties for light lightid, with id an integer in the range 0 ... 7. Valid
options are:
- -position vector: set light position
- -direction vector: set spot direction
- -ambient color: set ambient color for light
- -diffuse color: set diffuse color for light
- -specular color: set specular color for light
- -exponent double: set exponent for light attenuation. Default to 0.0
- -cutoff double: set cutoff for light, in degres. Defaut to 180
-
- -constant double: set constant coefficient for light attenuation. Default to
1.0
- -linear double: set linear coefficient for light attenuation. Default to
0.0
- -quadratic double: set quadratic coefficient for light attenuation. Default to
0.0
.
- pathName texture photoName
-
Defines a scene texture from Tk photo. Photo content is converted into
texture immediatly, so photo handle is no more used, and can be
released. Returns a texture Id to be used as -texture argument in
material sub-command.
- pathName texmode
- Defines the texture mode for future material. Valid values are decal,
replace, modulate or blend.
- pathName fog
-
- pathName translate
-
Translates scene. This transformation can be compiled into list.
- pathName scale
-
Scales scene. This transformation can be compiled into list.
- pathName rotate angle
-
Rotate scene. This transformation can be compiled into list.
- pathName enable
?flag flag ...?
- pathName disable
?flag flag ...?
-
Enable or disable features for scene. Valid values for flags are:
- offset
- fog
- lighting
- light0
- light1
- light2
- light3
- light4
- light5
- light6
- light7
- cull_face
- normalize
- dither
- depth_test
- alpha_test
- color_material
- blend
- texture_2d
- pathName navigate
- This commands registers bindings to navigate into scene. This is a
simple helper.
- pathName cameramove
- Moves camera location
- pathName camerarotate
-
- pathName render
-
- pathName dump ?photoname?
- Takes snapshot of scene content and save it into a Tk Photo handle. If
photoname is ommited, a photo name is automatically
attributed to result. Name of photo handle is returned.
BINDINGS
In the current implementation, new scenes are not given any default behavior. You'll
have to execute explicit Tcl commands to give the scene its behavior.
CREDITS
Even if no code comes from it, the developpment of this 3D scene widget has been
inspired by the Togl widget from Brian Paul (the author of the so great Mesa library). The
Togl widget was however not yet ported to Win32 platform when this project was initiated,
whereas it was our first need. Furthermore, the Togl widget requires C programming,
whereas we had the need for a pure portable scripting approach. We have the hope that,
whereas Togl is particulary suitable in offering to OpenGL developpers an easy way to
build a GUI for their application, our scene widget might help the Tcl/Tk communauty in
easily providing some 3D functionnalities in their applications.
|