- trying to fix bug 2781865

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1385 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
jtsiomb 2012-08-07 11:15:01 +00:00
parent d598173a25
commit 03fea19290

View File

@ -52,7 +52,7 @@
void checkError(const char *functionName) void checkError(const char *functionName)
{ {
GLenum error; 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); fprintf (stderr, "GL error 0x%X detected in %s\n", error, functionName);
} }
} }
@ -98,11 +98,17 @@ typedef char ourGLchar;
#define APIENTRY #define APIENTRY
#endif #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); typedef void (APIENTRY *PFNGLBINDVERTEXARRAYPROC) (GLuint array);
#endif
#ifndef GL_VERSION_1_5
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY *PFNGLBUFFERDATAPROC) (GLenum target, ourGLsizeiptr size, const GLvoid *data, GLenum usage); 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 GLuint (APIENTRY *PFNGLCREATESHADERPROC) (GLenum type);
typedef void (APIENTRY *PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const ourGLchar **string, const GLint *length); typedef void (APIENTRY *PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const ourGLchar **string, const GLint *length);
typedef void (APIENTRY *PFNGLCOMPILESHADERPROC) (GLuint shader); 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 void (APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
typedef GLint (APIENTRY *PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const ourGLchar *name); typedef GLint (APIENTRY *PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const ourGLchar *name);
typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
#endif
PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays; PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays;
PFNGLBINDVERTEXARRAYPROC gl_BindVertexArray; PFNGLBINDVERTEXARRAYPROC gl_BindVertexArray;
PFNGLGENBUFFERSPROC gl_GenBuffers; PFNGLGENBUFFERSPROC gl_GenBuffers;
PFNGLBINDBUFFERPROC gl_BindBuffer; PFNGLBINDBUFFERPROC gl_BindBuffer;
@ -142,9 +149,9 @@ PFNGLENABLEVERTEXATTRIBARRAYPROC gl_EnableVertexAttribArray;
PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation; PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv; 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_BindVertexArray = (PFNGLBINDVERTEXARRAYPROC) glutGetProcAddress ("glBindVertexArray");
gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers"); gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers");
gl_BindBuffer = (PFNGLBINDBUFFERPROC) glutGetProcAddress ("glBindBuffer"); gl_BindBuffer = (PFNGLBINDBUFFERPROC) glutGetProcAddress ("glBindBuffer");
@ -194,11 +201,11 @@ GLuint vertexArrayName;
void initBuffer(void) void initBuffer(void)
{ {
/* Need to setup a vertex array as otherwise invalid operation errors can /* 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 * occur when accessing vertex buffer (OpenGL 3.3 has no default zero named
* vertex array) * vertex array)
*/ */
gl_GenVertexArrays(1, &vertexArrayName); gl_GenVertexArrays(1, &vertexArrayName);
gl_BindVertexArray(vertexArrayName); gl_BindVertexArray(vertexArrayName);
gl_GenBuffers (1, &vertexBufferName); gl_GenBuffers (1, &vertexBufferName);