Skip to content

Commit 6b4ad68

Browse files
committed
Convert offset in VertexAttribPointer to uintptr.
The use of the parameter to provide an array seems to be deprecated, but that allows people to use it nevertheless, if they really want to. Fixes #93.
1 parent a98beac commit 6b4ad68

File tree

18 files changed

+36
-54
lines changed

18 files changed

+36
-54
lines changed

Diff for: gl/2.0/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1882,9 +1882,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
18821882
// GL.INVALID_VALUE is generated if index is greater than or equal to
18831883
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
18841884
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
1885-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
1886-
// What an awkward API. Just add a new function next time, please.
1887-
offset_ptr := unsafe.Pointer(uintptr(offset))
1885+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
1886+
offset_ptr := unsafe.Pointer(offset)
18881887
C.gl2_0_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
18891888
}
18901889

Diff for: gl/2.1/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1905,9 +1905,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
19051905
// GL.INVALID_VALUE is generated if index is greater than or equal to
19061906
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
19071907
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
1908-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
1909-
// What an awkward API. Just add a new function next time, please.
1910-
offset_ptr := unsafe.Pointer(uintptr(offset))
1908+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
1909+
offset_ptr := unsafe.Pointer(offset)
19111910
C.gl2_1_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
19121911
}
19131912

Diff for: gl/3.0/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2125,9 +2125,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
21252125
// GL.INVALID_VALUE is generated if index is greater than or equal to
21262126
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
21272127
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2128-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2129-
// What an awkward API. Just add a new function next time, please.
2130-
offset_ptr := unsafe.Pointer(uintptr(offset))
2128+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2129+
offset_ptr := unsafe.Pointer(offset)
21312130
C.gl3_0_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
21322131
}
21332132

Diff for: gl/3.1/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2186,9 +2186,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
21862186
// GL.INVALID_VALUE is generated if index is greater than or equal to
21872187
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
21882188
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2189-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2190-
// What an awkward API. Just add a new function next time, please.
2191-
offset_ptr := unsafe.Pointer(uintptr(offset))
2189+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2190+
offset_ptr := unsafe.Pointer(offset)
21922191
C.gl3_1_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
21932192
}
21942193

Diff for: gl/3.2compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2254,9 +2254,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
22542254
// GL.INVALID_VALUE is generated if index is greater than or equal to
22552255
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
22562256
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2257-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2258-
// What an awkward API. Just add a new function next time, please.
2259-
offset_ptr := unsafe.Pointer(uintptr(offset))
2257+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2258+
offset_ptr := unsafe.Pointer(offset)
22602259
C.gl3_2compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
22612260
}
22622261

Diff for: gl/3.2core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1799,9 +1799,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
17991799
// GL.INVALID_VALUE is generated if index is greater than or equal to
18001800
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
18011801
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
1802-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
1803-
// What an awkward API. Just add a new function next time, please.
1804-
offset_ptr := unsafe.Pointer(uintptr(offset))
1802+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
1803+
offset_ptr := unsafe.Pointer(offset)
18051804
C.gl3_2core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
18061805
}
18071806

Diff for: gl/3.3compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2270,9 +2270,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
22702270
// GL.INVALID_VALUE is generated if index is greater than or equal to
22712271
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
22722272
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2273-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2274-
// What an awkward API. Just add a new function next time, please.
2275-
offset_ptr := unsafe.Pointer(uintptr(offset))
2273+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2274+
offset_ptr := unsafe.Pointer(offset)
22762275
C.gl3_3compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
22772276
}
22782277

Diff for: gl/3.3core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2267,9 +2267,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
22672267
// GL.INVALID_VALUE is generated if index is greater than or equal to
22682268
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
22692269
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2270-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2271-
// What an awkward API. Just add a new function next time, please.
2272-
offset_ptr := unsafe.Pointer(uintptr(offset))
2270+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2271+
offset_ptr := unsafe.Pointer(offset)
22732272
C.gl3_3core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
22742273
}
22752274

Diff for: gl/4.0compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2347,9 +2347,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
23472347
// GL.INVALID_VALUE is generated if index is greater than or equal to
23482348
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
23492349
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2350-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2351-
// What an awkward API. Just add a new function next time, please.
2352-
offset_ptr := unsafe.Pointer(uintptr(offset))
2350+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2351+
offset_ptr := unsafe.Pointer(offset)
23532352
C.gl4_0compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
23542353
}
23552354

Diff for: gl/4.0core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2344,9 +2344,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
23442344
// GL.INVALID_VALUE is generated if index is greater than or equal to
23452345
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
23462346
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2347-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2348-
// What an awkward API. Just add a new function next time, please.
2349-
offset_ptr := unsafe.Pointer(uintptr(offset))
2347+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2348+
offset_ptr := unsafe.Pointer(offset)
23502349
C.gl4_0core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
23512350
}
23522351

Diff for: gl/4.1compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2383,9 +2383,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
23832383
// GL.INVALID_VALUE is generated if index is greater than or equal to
23842384
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
23852385
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2386-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2387-
// What an awkward API. Just add a new function next time, please.
2388-
offset_ptr := unsafe.Pointer(uintptr(offset))
2386+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2387+
offset_ptr := unsafe.Pointer(offset)
23892388
C.gl4_1compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
23902389
}
23912390

Diff for: gl/4.1core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2380,9 +2380,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
23802380
// GL.INVALID_VALUE is generated if index is greater than or equal to
23812381
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
23822382
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2383-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2384-
// What an awkward API. Just add a new function next time, please.
2385-
offset_ptr := unsafe.Pointer(uintptr(offset))
2383+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2384+
offset_ptr := unsafe.Pointer(offset)
23862385
C.gl4_1core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
23872386
}
23882387

Diff for: gl/4.2compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2492,9 +2492,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
24922492
// GL.INVALID_VALUE is generated if index is greater than or equal to
24932493
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
24942494
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2495-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2496-
// What an awkward API. Just add a new function next time, please.
2497-
offset_ptr := unsafe.Pointer(uintptr(offset))
2495+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2496+
offset_ptr := unsafe.Pointer(offset)
24982497
C.gl4_2compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
24992498
}
25002499

Diff for: gl/4.2core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2489,9 +2489,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
24892489
// GL.INVALID_VALUE is generated if index is greater than or equal to
24902490
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
24912491
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2492-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2493-
// What an awkward API. Just add a new function next time, please.
2494-
offset_ptr := unsafe.Pointer(uintptr(offset))
2492+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2493+
offset_ptr := unsafe.Pointer(offset)
24952494
C.gl4_2core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
24962495
}
24972496

Diff for: gl/4.3compat/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2751,9 +2751,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
27512751
// GL.INVALID_VALUE is generated if index is greater than or equal to
27522752
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
27532753
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2754-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2755-
// What an awkward API. Just add a new function next time, please.
2756-
offset_ptr := unsafe.Pointer(uintptr(offset))
2754+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2755+
offset_ptr := unsafe.Pointer(offset)
27572756
C.gl4_3compat_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
27582757
}
27592758

Diff for: gl/4.3core/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2747,9 +2747,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
27472747
// GL.INVALID_VALUE is generated if index is greater than or equal to
27482748
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
27492749
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2750-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2751-
// What an awkward API. Just add a new function next time, please.
2752-
offset_ptr := unsafe.Pointer(uintptr(offset))
2750+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2751+
offset_ptr := unsafe.Pointer(offset)
27532752
C.gl4_3core_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
27542753
}
27552754

Diff for: gl/es2/gl.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2695,9 +2695,8 @@ func (gl *GL) VertexAttrib4fv(index glbase.Attrib, values []float32) {
26952695
// GL.INVALID_VALUE is generated if index is greater than or equal to
26962696
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
26972697
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
2698-
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
2699-
// What an awkward API. Just add a new function next time, please.
2700-
offset_ptr := unsafe.Pointer(uintptr(offset))
2698+
func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
2699+
offset_ptr := unsafe.Pointer(offset)
27012700
C.gles2_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
27022701
}
27032702

Diff for: gl/gengl/funcs.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1723,11 +1723,10 @@ var funcTweakList = []funcTweak{{
17231723
}, {
17241724
name: "VertexAttribPointer",
17251725
params: paramTweaks{
1726-
"pointer": {rename: "offset", retype: "int"},
1726+
"pointer": {rename: "offset", retype: "uintptr"},
17271727
},
17281728
before: `
1729-
// What an awkward API. Just add a new function next time, please.
1730-
offset_ptr := unsafe.Pointer(uintptr(offset))
1729+
offset_ptr := unsafe.Pointer(offset)
17311730
`,
17321731
doc: `
17331732
specifies the location and data format of the array

0 commit comments

Comments
 (0)