From: John Tsiombikas Date: Tue, 7 Aug 2012 11:15:01 +0000 (+0000) Subject: - trying to fix bug 2781865 X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=7f16b88649f41b77a0532422e3861e260d683d9f;p=freeglut - trying to fix bug 2781865 git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1385 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/progs/demos/smooth_opengl3/smooth_opengl3.c b/progs/demos/smooth_opengl3/smooth_opengl3.c index 965d93b..622b95c 100755 --- a/progs/demos/smooth_opengl3/smooth_opengl3.c +++ b/progs/demos/smooth_opengl3/smooth_opengl3.c @@ -52,7 +52,7 @@ void checkError(const char *functionName) { GLenum error; - while (( error = glGetError() ) != GL_NO_ERROR) { + while (( error = glGetError() ) != GL_NO_ERROR) { fprintf (stderr, "GL error 0x%X detected in %s\n", error, functionName); } } @@ -98,11 +98,17 @@ typedef char ourGLchar; #define APIENTRY #endif -typedef void (APIENTRY *PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); + +#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); @@ -119,8 +125,9 @@ typedef void (APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, 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; +PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays; PFNGLBINDVERTEXARRAYPROC gl_BindVertexArray; PFNGLGENBUFFERSPROC gl_GenBuffers; PFNGLBINDBUFFERPROC gl_BindBuffer; @@ -142,9 +149,9 @@ PFNGLENABLEVERTEXATTRIBARRAYPROC gl_EnableVertexAttribArray; PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation; PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv; -void initExtensionEntries(void) +void initExtensionEntries(void) { - gl_GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) glutGetProcAddress ("glGenVertexArrays"); + gl_GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) glutGetProcAddress ("glGenVertexArrays"); gl_BindVertexArray = (PFNGLBINDVERTEXARRAYPROC) glutGetProcAddress ("glBindVertexArray"); gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers"); gl_BindBuffer = (PFNGLBINDBUFFERPROC) glutGetProcAddress ("glBindBuffer"); @@ -194,11 +201,11 @@ GLuint vertexArrayName; void initBuffer(void) { - /* 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); + /* 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);