Gambas文档
编译和安装
错误消息
代码片段
待办事项
废弃的组件
教程
开发环境文档
开发者文档
名词解释
如何操作
说明
维基手册
维基搜索
维基许可协议
文档
应用程序仓库
语言概览
语言索引
主题
组件
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.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.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.qt
gb.gui.qt.ext
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.io
gb.inotify
gb.logging
gb.map
gb.media
gb.media.form
gb.mime
gb.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.opengl
Gl
gb.opengl.glsl
gb.opengl.glu
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.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.sdl
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
最近的修改

Gl.FeedbackBuffer (gb.opengl)

Static Sub FeedbackBuffer ( Type As Integer )

Controls feedback mode.

Parameters

size

Specifies the maximum number of values that can be written into buffer.
type

Specifies a symbolic constant that describes the information that will be returned for each vertex. Gl.2D, Gl.3D, Gl.3D_COLOR, Gl.3D_COLOR_TEXTURE, and Gl.4D_COLOR_TEXTURE are accepted.
buffer

Returns the feedback data.

Description

The Gl.FeedbackBuffer function controls feedback. Feedback, like selection, is a GL mode. The mode is selected by calling Gl.RenderMode with Gl.FEEDBACK. When the GL is in feedback mode, no pixels are produced by rasterization. Instead, information about primitives that would have been rasterized is fed back to the application using the GL.

Gl.FeedbackBuffer has three arguments: buffer is a pointer to an array of floating-point values into which feedback information is placed. size indicates the size of the array. type is a symbolic constant describing the information that is fed back for each vertex. Gl.FeedbackBuffer must be issued before feedback mode is enabled (by calling Gl.RenderMode with argument Gl.FEEDBACK). Setting Gl.FEEDBACK without establishing the feedback buffer, or calling Gl.FeedbackBuffer while the GL is in feedback mode, is an error.

When Gl.RenderMode is called while in feedback mode, it returns the number of entries placed in the feedback array and resets the feedback array pointer to the base of the feedback buffer. The returned value never exceeds size. If the feedback data required more room than was available in buffer, Gl.RenderMode returns a negative value. To take the GL out of feedback mode, call Gl.RenderMode with a parameter value other than Gl.FEEDBACK.

While in feedback mode, each primitive, bitmap, or pixel rectangle that would be rasterized generates a block of values that are copied into the feedback array. If doing so would cause the number of entries to exceed the maximum, the block is partially written so as to fill the array (if there is any room left at all), and an overflow flag is set. Each block begins with a code indicating the primitive type, followed by values that describe the primitive's vertices and associated data. Entries are also written for bitmaps and pixel rectangles. Feedback occurs after polygon culling and Gl.PolygonMode interpretation of polygons has taken place, so polygons that are culled are not returned in the feedback buffer. It can also occur after polygons with more than three edges are broken up into triangles, if the GL implementation renders polygons by performing this decomposition.

The Gl.PassThrough command can be used to insert a marker into the feedback buffer. See Gl.PassThrough.

Following is the grammar for the blocks of values written into the feedback buffer. Each primitive is indicated with a unique identifying value followed by some number of vertices. Polygon entries include an integer value indicating how many vertices follow. A vertex is fed back as some number of floating-point values, as determined by type. Colors are fed back as four values in RGBA mode and one value in color index mode.

feedbackList feedbackItem feedbackList | feedbackItem

feedbackItem point | lineSegment | polygon | bitmap | pixelRectangle | passThru

point Gl.POINT_TOKEN vertex

lineSegment Gl.LINE_TOKEN vertex vertex | Gl.LINE_RESET_TOKEN vertex vertex

polygon Gl.POLYGON_TOKEN n polySpec

polySpec polySpec vertex | vertex vertex vertex

bitmap Gl.BITMAP_TOKEN vertex

pixelRectangle Gl.DRAW_PIXEL_TOKEN vertex | Gl.COPY_PIXEL_TOKEN vertex

passThru Gl.PASS_THROUGH_TOKEN value

vertex 2d | 3d | 3dColor | 3dColorTexture | 4dColorTexture

2d value value

3d value value value

3dColor value value value color

3dColorTexture value value value color tex

4dColorTexture value value value value color tex

color rgba | index

rgba value value value value

index value

tex value value value value

value is a floating-point number, and n is a floating-point integer giving the number of vertices in the polygon. Gl.POINT_TOKEN, Gl.LINE_TOKEN, Gl.LINE_RESET_TOKEN, Gl.POLYGON_TOKEN, Gl.BITMAP_TOKEN, Gl.DRAW_PIXEL_TOKEN, Gl.COPY_PIXEL_TOKEN and Gl.PASS_THROUGH_TOKEN are symbolic floating-point constants. Gl.LINE_RESET_TOKEN is returned whenever the line stipple pattern is reset. The data returned as a vertex depends on the feedback type.

The following table gives the correspondence between type and the number of values per vertex. k is 1 in color index mode and 4 in RGBA mode.

Type Coordinates Color Texture Total Number of Values
Gl.2D x, y 2
Gl.3D x, y, z 3
Gl.3D_COLOR x, y, z k 3 + k
Gl.3D_COLOR_TEXTURE x, y, z k 4 7 + k
Gl.4D_COLOR_TEXTURE x, y, z, w k 4 8 + k

Feedback vertex coordinates are in window coordinates, except w, which is in clip coordinates. Feedback colors are lighted, if lighting is enabled. Feedback texture coordinates are generated, if texture coordinate generation is enabled. They are always transformed by the texture matrix.

Notes

Gl.FeedbackBuffer, when used in a display list, is not compiled into the display list but is executed immediately.

Gl.FeedbackBuffer returns only the texture coordinate of texture unit Gl.TEXTURE0.

Errors

Gl.INVALID_ENUM is generated if type is not an accepted value.

Gl.INVALID_VALUE is generated if size is negative.

Gl.INVALID_OPERATION is generated if Gl.FeedbackBuffer is called while the render mode is Gl.FEEDBACK, or if Gl.RenderMode is called with argument Gl.FEEDBACK before Gl.FeedbackBuffer is called at least once.

Gl.INVALID_OPERATION is generated if Gl.FeedbackBuffer is executed between the execution of Gl.Begin and the corresponding execution of Gl.End.

Associated Gets

Gl.Get with argument Gl.RENDER_MODE

Gl.Get with argument Gl.FEEDBACK_BUFFER_POINTER

Gl.Get with argument Gl.FEEDBACK_BUFFER_SIZE

Gl.Get with argument Gl.FEEDBACK_BUFFER_TYPE

See also

Gl.Begin, Gl.LineStipple, Gl.PassThrough, Gl.SelectBuffer

See original documentation on OpenGL website