void checkError(const char *functionName)
{
GLenum error;
- while (( error = glGetError() ) != GL_NO_ERROR) {\r
+ while (( error = glGetError() ) != GL_NO_ERROR) {
fprintf (stderr, "GL error 0x%X detected in %s\n", error, functionName);
}
}
#define APIENTRY
#endif
-typedef void (APIENTRY *PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);\r
+
+#ifndef GL_ARB_vertex_array_object
+typedef void (APIENTRY *PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
typedef void (APIENTRY *PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+#endif
+#ifndef GL_VERSION_1_5
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY *PFNGLBUFFERDATAPROC) (GLenum target, ourGLsizeiptr size, const GLvoid *data, GLenum usage);
+#endif
+#ifndef GL_VERSION_2_0
typedef GLuint (APIENTRY *PFNGLCREATESHADERPROC) (GLenum type);
typedef void (APIENTRY *PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const ourGLchar **string, const GLint *length);
typedef void (APIENTRY *PFNGLCOMPILESHADERPROC) (GLuint shader);
typedef void (APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
typedef GLint (APIENTRY *PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const ourGLchar *name);
typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
-PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays;\r
+PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays;
PFNGLBINDVERTEXARRAYPROC gl_BindVertexArray;
PFNGLGENBUFFERSPROC gl_GenBuffers;
PFNGLBINDBUFFERPROC gl_BindBuffer;
PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv;
-void initExtensionEntries(void)
+void initExtensionEntries(void)
{
- gl_GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) glutGetProcAddress ("glGenVertexArrays");\r
+ gl_GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) glutGetProcAddress ("glGenVertexArrays");
gl_BindVertexArray = (PFNGLBINDVERTEXARRAYPROC) glutGetProcAddress ("glBindVertexArray");
gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers");
gl_BindBuffer = (PFNGLBINDBUFFERPROC) glutGetProcAddress ("glBindBuffer");
void initBuffer(void)
{
- /* Need to setup a vertex array as otherwise invalid operation errors can\r
- * occur when accessing vertex buffer (OpenGL 3.3 has no default zero named\r
- * vertex array) \r
- */\r
- gl_GenVertexArrays(1, &vertexArrayName);\r
+ /* Need to setup a vertex array as otherwise invalid operation errors can
+ * occur when accessing vertex buffer (OpenGL 3.3 has no default zero named
+ * vertex array)
+ */
+ gl_GenVertexArrays(1, &vertexArrayName);
gl_BindVertexArray(vertexArrayName);
gl_GenBuffers (1, &vertexBufferName);