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.db2
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.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
Gl
ACTIVE_ATTRIBUTE_MAX_LENGTH
ACTIVE_ATTRIBUTES
ACTIVE_UNIFORM_MAX_LENGTH
ACTIVE_UNIFORMS
ATTACHED_SHADERS
AttachShader
BindAttribLocation
COMPILE_STATUS
CompileShader
CreateProgram
CreateShader
CURRENT_PROGRAM
DELETE_STATUS
DeleteProgram
DeleteShader
DetachShader
FRAGMENT_SHADER
GetAttachedShaders
GetProgramInfoLog
GetProgramiv
GetShaderInfoLog
GetShaderiv
GetShaderSource
GetUniformLocation
INFO_LOG_LENGTH
IsProgram
IsShader
LINK_STATUS
LinkProgram
SHADER_SOURCE_LENGTH
SHADER_TYPE
ShaderSource
Uniform1f
Uniform1fv
Uniform1i
Uniform1iv
Uniform2f
Uniform2fv
Uniform2i
Uniform2iv
Uniform3f
Uniform3fv
Uniform3i
Uniform3iv
Uniform4f
Uniform4fv
Uniform4i
Uniform4iv
UniformMatrix2fv
UniformMatrix2x3fv
UniformMatrix2x4fv
UniformMatrix3fv
UniformMatrix3x2fv
UniformMatrix3x4fv
UniformMatrix4fv
UniformMatrix4x2fv
UniformMatrix4x3fv
UseProgram
VALIDATE_STATUS
ValidateProgram
VERTEX_SHADER
VertexAttrib1f
VertexAttrib1fv
VertexAttrib2f
VertexAttrib2fv
VertexAttrib3f
VertexAttrib3fv
VertexAttrib4f
VertexAttrib4fv
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.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

Gl.VertexAttrib1fv (gb.opengl.glsl)

Static Sub VertexAttrib1fv ( Index As Integer, V As Float[] )

Specifies the value of a generic vertex attribute.

Parameters

index

Specifies the index of the generic vertex attribute to be modified.
v0, v1, v2, v3

Specifies the new values to be used for the specified vertex attribute.

Parameters

index

Specifies the index of the generic vertex attribute to be modified.
v

Specifies a pointer to an array of values to be used for the generic vertex attribute.

Parameters

index

Specifies the index of the generic vertex attribute to be modified.
type

Type of packing used on the data. This parameter must be Gl.INT_10_10_10_2 or Gl.UNSIGNED_INT_10_10_10_2 to specify signed or unsigned data, respectively.
normalized

If Gl.TRUE, then the values are to be converted to floating point values by normalizing. Otherwise, they are converted directly to floating point values.
value

Specifies the new packed value to be used for the specified vertex attribute.

Description

OpenGL defines a number of standard vertex attributes that applications can modify with standard API entry points (color, normal, texture coordinates, etc.). The Gl.VertexAttrib family of entry points allows an application to pass generic vertex attributes in numbered locations.

Generic attributes are defined as four-component values that are organized into an array. The first entry of this array is numbered 0, and the size of the array is specified by the implementation-dependent constant Gl.MAX_VERTEX_ATTRIBS. Individual elements of this array can be modified with a Gl.VertexAttrib call that specifies the index of the element to be modified and a value for that element.

These commands can be used to specify one, two, three, or all four components of the generic vertex attribute specified by index. A 1 in the name of the command indicates that only one value is passed, and it will be used to modify the first component of the generic vertex attribute. The second and third components will be set to 0, and the fourth component will be set to 1. Similarly, a 2 in the name of the command indicates that values are provided for the first two components, the third component will be set to 0, and the fourth component will be set to 1. A 3 in the name of the command indicates that values are provided for the first three components and the fourth component will be set to 1, whereas a 4 in the name indicates that values are provided for all four components.

The letters s, f, i, d, ub, us, and ui indicate whether the arguments are of type short, float, int, double, unsigned byte, unsigned short, or unsigned int. When v is appended to the name, the commands can take a pointer to an array of such values.

Additional capitalized letters can indicate further alterations to the default behavior of the glVertexAttrib function:

The commands containing N indicate that the arguments will be passed as fixed-point values that are scaled to a normalized range according to the component conversion rules defined by the OpenGL specification. Signed values are understood to represent fixed-point values in the range /wiki/-1,1, and unsigned values are understood to represent fixed-point values in the range /wiki/0,1.

The commands containing I indicate that the arguments are extended to full signed or unsigned integers.

The commands containing P indicate that the arguments are stored as packed components within a larger natural type.

OpenGL Shading Language attribute variables are allowed to be of type mat2, mat3, or mat4. Attributes of these types may be loaded using the Gl.VertexAttrib entry points. Matrices must be loaded into successive generic attribute slots in column major order, with one column of the matrix in each generic attribute slot.

A user-defined attribute variable declared in a vertex shader can be bound to a generic attribute index by calling Gl.BindAttribLocation. This allows an application to use more descriptive variable names in a vertex shader. A subsequent change to the specified generic vertex attribute will be immediately reflected as a change to the corresponding attribute variable in the vertex shader.

The binding between a generic vertex attribute index and a user-defined attribute variable in a vertex shader is part of the state of a program object, but the current value of the generic vertex attribute is not. The value of each generic vertex attribute is part of current state, just like standard vertex attributes, and it is maintained even if a different program object is used.

An application may freely modify generic vertex attributes that are not bound to a named vertex shader attribute variable. These values are simply maintained as part of current state and will not be accessed by the vertex shader. If a generic vertex attribute bound to an attribute variable in a vertex shader is not updated while the vertex shader is executing, the vertex shader will repeatedly use the current value for the generic vertex attribute.

Notes

Generic vertex attributes can be updated at any time.

It is possible for an application to bind more than one attribute name to the same generic vertex attribute index. This is referred to as aliasing, and it is allowed only if just one of the aliased attribute variables is active in the vertex shader, or if no path through the vertex shader consumes more than one of the attributes aliased to the same location. OpenGL implementations are not required to do error checking to detect aliasing, they are allowed to assume that aliasing will not occur, and they are allowed to employ optimizations that work only in the absence of aliasing.

There is no provision for binding standard vertex attributes; therefore, it is not possible to alias generic attributes with standard attributes.

Gl.VertexAttrib4bv, Gl.VertexAttrib4sv, Gl.VertexAttrib4iv, Gl.VertexAttrib4ubv, Gl.VertexAttrib4usv, Gl.VertexAttrib4uiv, and Gl.VertexAttrib4N versions are available only if the GL version is 3.1 or higher.

Gl.VertexAttribP versions are available only if the GL version is 3.3 or higher.

Errors

Gl.INVALID_VALUE is generated if index is greater than or equal to Gl.MAX_VERTEX_ATTRIBS.

Gl.INVALID_ENUM is generated if Gl.VertexAttribP is used with a type other than Gl.INT_10_10_10_2 or Gl.UNSIGNED_INT_10_10_10_2.

Associated Gets

Gl.Get with the argument Gl.CURRENT_PROGRAM

Gl.GetActiveAttrib with argument program and the index of an active attribute variable

Gl.GetAttribLocation with argument program and an attribute variable name

Gl.GetVertexAttrib with arguments Gl.CURRENT_VERTEX_ATTRIB and index

See also

Gl.VertexAttribPointer

See original documentation on OpenGL website