Permalink
Browse files

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.
  • Loading branch information...
1 parent a98beac commit 6b4ad68c74e53d9e9cc78d41cac988bb0b33f206 @niemeyer niemeyer committed Sep 6, 2014
View
@@ -1882,9 +1882,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -1905,9 +1905,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2125,9 +2125,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2186,9 +2186,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2254,9 +2254,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -1799,9 +1799,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2270,9 +2270,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2267,9 +2267,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2347,9 +2347,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2344,9 +2344,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2383,9 +2383,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2380,9 +2380,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2492,9 +2492,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2489,9 +2489,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2751,9 +2751,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2747,9 +2747,8 @@ func (gl *GL) GenQueries(n int, ids []uint32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
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)
}
View
@@ -2695,9 +2695,8 @@ func (gl *GL) VertexAttrib4fv(index glbase.Attrib, values []float32) {
// GL.INVALID_VALUE is generated if index is greater than or equal to
// GL.MAX_VERTEX_ATTRIBS. GL.INVALID_VALUE is generated if size is not 1, 2,
// 3, or 4. GL.INVALID_VALUE is generated if stride is negative.
-func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride, offset int) {
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+func (gl *GL) VertexAttribPointer(index glbase.Attrib, size int, gltype glbase.Enum, normalized bool, stride int, offset uintptr) {
+ offset_ptr := unsafe.Pointer(offset)
C.gles2_glVertexAttribPointer(gl.funcs, C.GLuint(index), C.GLint(size), C.GLenum(gltype), *(*C.GLboolean)(unsafe.Pointer(&normalized)), C.GLsizei(stride), offset_ptr)
}
View
@@ -1723,11 +1723,10 @@ var funcTweakList = []funcTweak{{
}, {
name: "VertexAttribPointer",
params: paramTweaks{
- "pointer": {rename: "offset", retype: "int"},
+ "pointer": {rename: "offset", retype: "uintptr"},
},
before: `
- // What an awkward API. Just add a new function next time, please.
- offset_ptr := unsafe.Pointer(uintptr(offset))
+ offset_ptr := unsafe.Pointer(offset)
`,
doc: `
specifies the location and data format of the array

0 comments on commit 6b4ad68

Please sign in to comment.