#define _glVertexAttribPointerARB_size(size, type, normalized, stride, count) _glArrayPointer_size(size, type, stride, count)
#define _glVertexAttribPointerNV_size(size, type, stride, count) _glArrayPointer_size(size, type, stride, count)
+/**
+ * Same as glGetIntegerv, but passing the result in the return value.
+ */
+static inline GLint
+_glGetInteger(GLenum pname) {
+ GLint param = 0;
+ _glGetIntegerv(pname, ¶m);
+ return param;
+}
+
static inline GLint
_element_array_buffer_binding(void) {
- GLint element_array_buffer = 0;
- _glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &element_array_buffer);
- return element_array_buffer;
+ return _glGetInteger(GL_ELEMENT_ARRAY_BUFFER_BINDING);
}
static inline GLuint
}
}
+
+/**
+ * Helper function for determining the string lengths for glShaderSource and
+ * glShaderSourceARB, which is a tad too complex to inline in the specs.
+ */
+template<class T>
+static inline size_t
+_glShaderSource_length(const T * const * string, const GLint *length, GLsizei index)
+{
+ if (length != NULL && length[index] >= 0) {
+ return (size_t)length[index];
+ } else {
+ return strlen(string[index]);
+ }
+}
+
/*
* attribute list, terminated by the given terminator.
*/