@@ -127,7 +127,8 @@ export class Buffer extends AbstractObject<WebGLBuffer> implements Bindable {
127
127
}
128
128
129
129
/**
130
- * Specifies the memory layout of the buffer for a binding point.
130
+ * Specifies the memory layout of the buffer for a binding point. Integer data will be cast to float according to
131
+ * "normalized".
131
132
* @param index - Index of the vertex attribute that is to be setup and enabled.
132
133
* @param size - Number of components per vertex attribute.
133
134
* @param type - Data type of each component in the array.
@@ -136,6 +137,7 @@ export class Buffer extends AbstractObject<WebGLBuffer> implements Bindable {
136
137
* @param offset - Offset in bytes of the first component in the vertex attribute array.
137
138
* @param bind - Allows to skip binding the object (e.g., when binding is handled outside).
138
139
* @param unbind - Allows to skip unbinding the object (e.g., when binding is handled outside).
140
+ * @see attribEnableInt
139
141
*/
140
142
@Initializable . assert_initialized ( )
141
143
attribEnable ( index : GLuint , size : GLint , type : GLenum , normalized : GLboolean = false ,
@@ -152,6 +154,32 @@ export class Buffer extends AbstractObject<WebGLBuffer> implements Bindable {
152
154
}
153
155
}
154
156
157
+ /**
158
+ * Specifies the memory layout of the buffer for a binding point. Only to be used for integers.
159
+ * @param index - Index of the vertex attribute that is to be setup and enabled.
160
+ * @param size - Number of components per vertex attribute.
161
+ * @param type - Data type of each component in the array.
162
+ * @param stride - Offset in bytes between the beginning of consecutive vertex attributes.
163
+ * @param offset - Offset in bytes of the first component in the vertex attribute array.
164
+ * @param bind - Allows to skip binding the object (e.g., when binding is handled outside).
165
+ * @param unbind - Allows to skip unbinding the object (e.g., when binding is handled outside).
166
+ * @see attribEnable
167
+ */
168
+ @Initializable . assert_initialized ( )
169
+ attribEnableInt ( index : GLuint , size : GLint , type : GLenum ,
170
+ stride : GLsizei = 0 , offset : GLintptr = 0 , bind : boolean = true , unbind : boolean = true ) : void {
171
+
172
+ const gl = this . context . gl ;
173
+ if ( bind ) {
174
+ this . bind ( ) ;
175
+ }
176
+ gl . vertexAttribIPointer ( index , size , type , stride , offset ) ;
177
+ gl . enableVertexAttribArray ( index ) ;
178
+ if ( unbind ) {
179
+ this . unbind ( ) ;
180
+ }
181
+ }
182
+
155
183
/**
156
184
* Disables a buffer binding point.
157
185
* @param index - Index of the vertex attribute that is to be disabled.
0 commit comments