Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.ext
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
Glu
AUTO_LOAD_MATRIX
BeginCurve
BeginSurface
BeginTrim
Build1DMipmaps
Build2DMipmaps
ClearColor
Color
CULLING
Cylinder
DeleteNurbsRenderer
Disk
DISPLAY_MODE
EndCurve
EndSurface
EndTrim
ErrorString
FILL
FLAT
INSIDE
INVALID_ENUM
INVALID_VALUE
LINE
LookAt
NewNurbsRenderer
NewQuadric
NONE
NURBS_MODE
NurbsCurve
NurbsProperty
NurbsSurface
Ortho2D
OUT_OF_MEMORY
OUTSIDE
PARAMETRIC_TOLERANCE
PartialDisk
Perspective
PickMatrix
POINT
Project
QuadricDrawStyle
QuadricNormals
QuadricOrientation
QuadricTexture
SAMPLING_METHOD
SAMPLING_TOLERANCE
SILHOUETTE
SMOOTH
Sphere
U_STEP
UnProject
UnProject4
V_STEP
GluNurb
GluQuadric
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Glu.BeginTrim (gb.opengl.glu)

Static Sub BeginTrim ( Nurb As GluNurb )

Delimit a NURBS trimming loop definition.

Parameters

nurb

Specifies the NURBS object (created with Glu.NewNurbsRenderer).

Description

Use Glu.BeginTrim to mark the beginning of a trimming loop and Glu.EndTrim to mark the end of a trimming loop. A trimming loop is a set of oriented curve segments (forming a closed curve) that define boundaries of a NURBS surface. You include these trimming loops in the definition of a NURBS surface, between calls to Glu.BeginSurface and Glu.EndSurface.

The definition for a NURBS surface can contain many trimming loops. For example, if you wrote a definition for a NURBS surface that resembled a rectangle with a hole punched out, the definition would contain two trimming loops. One loop would define the outer edge of the rectangle; the other would define the hole punched out of the rectangle. The definitions of each of these trimming loops would be bracketed by a Glu.BeginTrim*/Glu.EndTrim pair.

The definition of a single closed trimming loop can consist of multiple curve segments, each described as a piecewise linear curve (see Glu.PwlCurve) or as a single NURBS curve (see Glu.NurbsCurve), or as a combination of both in any order. The only library calls that can appear in a trimming loop definition (between the calls to Glu.BeginTrim and Glu.EndTrim) are Glu.PwlCurve and Glu.NurbsCurve.

The area of the NURBS surface that is displayed is the region in the domain to the left of the trimming curve as the curve parameter increases. Thus, the retained region of the NURBS surface is inside a counterclockwise trimming loop and outside a clockwise trimming loop. For the rectangle mentioned earlier, the trimming loop for the outer edge of the rectangle runs counterclockwise, while the trimming loop for the punched-out hole runs clockwise.

If you use more than one curve to define a single trimming loop, the curve segments must form a closed loop (that is, the endpoint of each curve must be the starting point of the next curve, and the endpoint of the final curve must be the starting point of the first curve). If the endpoints of the curve are sufficiently close together but not exactly coincident, they will be coerced to match. If the endpoints are not sufficiently close, an error results (see Glu.NurbsCallback).

If a trimming loop definition contains multiple curves, the direction of the curves must be consistent (that is, the inside must be to the left of all of the curves). Nested trimming loops are legal as long as the curve orientations alternate correctly. If trimming curves are self-intersecting, or intersect one another, an error results.

If no trimming information is given for a NURBS surface, the entire surface is drawn.

Example

This code fragment defines a trimming loop that consists of one piecewise linear curve, and two NURBS curves:
gluBeginTrim(nobj);
gluPwlCurve(..., GLU_MAP1_TRIM_2);
gluNurbsCurve(..., GLU_MAP1_TRIM_2);
gluNurbsCurve(..., GLU_MAP1_TRIM_3);
gluEndTrim(nobj);

See also

Glu.NurbsCallback, Glu.NurbsCurve, Glu.PwlCurve

See original documentation on OpenGL website