Based on the code you just provided, I suspect the demo program will fail to compile on sufficiently recent mesa as well. If you want to run the test, you need to comment out all the typedefs (not the actual code). The application should not be providing the PFNGL*PROC typedefs. Those are provided by glext.h and gl.h in mesa, windows, and our glx. The only OpenGL implementation that doesn't provide them is OSX's OpenGL.framework since they provide the typedefs under a different naming convention. Our (GLX) gl headers support both. If they're blindly doing things like "typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);" in their code, then they fail. --Jeremy On Apr 26, 2009, at 09:23, Jack Howarth wrote:
On Sat, Apr 25, 2009 at 10:47:46PM -0700, Jeremy Huddleston wrote:
That is an "interesting" issue... I'm guessing that freeglut test probably has something like:
#ifdef __APPLE__ #define PFNGLGENBUFFERSPROC ... ... #endif
That's because Apple's OpenGL.framework doesn't use the same naming convention for the OpenGL function pointer types as Mesa/Windows does. We exist in an awkward state bridging the two... in order to be as compatible as possible at the source level, I decided to support both conventions.
It looks like the freeglut test tried to be too clever for its own good...
Jeremy, I tried...
--- smooth_opengl3.c.org 2009-04-26 12:11:41.000000000 -0400 +++ smooth_opengl3.c 2009-04-26 12:18:29.000000000 -0400 @@ -98,6 +98,8 @@ #define APIENTRY #endif
+#ifndef __APPLE__ + typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); PFNGLGENBUFFERSPROC gl_GenBuffers;
@@ -178,6 +180,8 @@ gl_UniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) glutGetProcAddress ("glUniformMatrix4fv"); }
+#endif + /* vertex array data for a colored 2D triangle, consisting of RGB color values and XY coordinates */ const GLfloat varray[] = {
but the compilation fails because the wrapper encloses definition for gl extensions at the end...
#ifndef __APPLE__
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); PFNGLGENBUFFERSPROC gl_GenBuffers;
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); PFNGLBINDBUFFERPROC gl_BindBuffer;
typedef void (APIENTRY *PFNGLBUFFERDATAPROC) (GLenum target, ourGLsizeiptr size, const GLvoid *data, GLenum usage); PFNGLBUFFERDATAPROC gl_BufferData;
typedef GLuint (APIENTRY *PFNGLCREATESHADERPROC) (GLenum type); PFNGLCREATESHADERPROC gl_CreateShader;
typedef void (APIENTRY *PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const ourGLchar **string, const GLint *length); PFNGLSHADERSOURCEPROC gl_ShaderSource;
typedef void (APIENTRY *PFNGLCOMPILESHADERPROC) (GLuint shader); PFNGLCOMPILESHADERPROC gl_CompileShader;
typedef GLuint (APIENTRY *PFNGLCREATEPROGRAMPROC) (void); PFNGLCREATEPROGRAMPROC gl_CreateProgram;
typedef void (APIENTRY *PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); PFNGLATTACHSHADERPROC gl_AttachShader;
typedef void (APIENTRY *PFNGLLINKPROGRAMPROC) (GLuint program); PFNGLLINKPROGRAMPROC gl_LinkProgram;
typedef void (APIENTRY *PFNGLUSEPROGRAMPROC) (GLuint program); PFNGLUSEPROGRAMPROC gl_UseProgram;
typedef void (APIENTRY *PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); PFNGLGETSHADERIVPROC gl_GetShaderiv;
typedef void (APIENTRY *PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, ourGLchar *infoLog); PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog;
typedef void (APIENTRY *PFNGLGETPROGRAMIVPROC) (GLenum target, GLenum pname, GLint *params); PFNGLGETPROGRAMIVPROC gl_GetProgramiv;
typedef void (APIENTRY *PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, ourGLchar *infoLog); PFNGLGETPROGRAMINFOLOGPROC gl_GetProgramInfoLog;
typedef GLint (APIENTRY *PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const ourGLchar *name); PFNGLGETATTRIBLOCATIONPROC gl_GetAttribLocation;
typedef void (APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); PFNGLVERTEXATTRIBPOINTERPROC gl_VertexAttribPointer;
typedef void (APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); PFNGLENABLEVERTEXATTRIBARRAYPROC gl_EnableVertexAttribArray;
typedef GLint (APIENTRY *PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const ourGLchar *name); PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv;
void initExtensionEntries(void) { gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers"); gl_BindBuffer = (PFNGLBINDBUFFERPROC) glutGetProcAddress ("glBindBuffer"); gl_BufferData = (PFNGLBUFFERDATAPROC) glutGetProcAddress ("glBufferData"); gl_CreateShader = (PFNGLCREATESHADERPROC) glutGetProcAddress ("glCreateShader"); gl_ShaderSource = (PFNGLSHADERSOURCEPROC) glutGetProcAddress ("glShaderSource"); gl_CompileShader = (PFNGLCOMPILESHADERPROC) glutGetProcAddress ("glCompileShader"); gl_CreateProgram = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress ("glCreateProgram"); gl_AttachShader = (PFNGLATTACHSHADERPROC) glutGetProcAddress ("glAttachShader"); gl_LinkProgram = (PFNGLLINKPROGRAMPROC) glutGetProcAddress ("glLinkProgram"); gl_UseProgram = (PFNGLUSEPROGRAMPROC) glutGetProcAddress ("glUseProgram"); gl_GetShaderiv = (PFNGLGETSHADERIVPROC) glutGetProcAddress ("glGetShaderiv"); gl_GetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) glutGetProcAddress ("glGetShaderInfoLog"); gl_GetProgramiv = (PFNGLGETPROGRAMIVPROC) glutGetProcAddress ("glGetProgramiv"); gl_GetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress ("glGetProgramInfoLog"); gl_GetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress ("glGetAttribLocation"); gl_VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) glutGetProcAddress ("glVertexAttribPointer"); gl_EnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) glutGetProcAddress ("glEnableVertexAttribArray"); gl_GetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress ("glGetUniformLocation"); gl_UniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) glutGetProcAddress ("glUniformMatrix4fv"); }
#endif
Should we have those initExtensionEntries avallable somewhere? I also tried...
--- smooth_opengl3.c.org 2009-04-26 12:11:41.000000000 -0400 +++ smooth_opengl3.c 2009-04-26 12:21:50.000000000 -0400 @@ -98,6 +98,8 @@ #define APIENTRY #endif
+#ifndef __APPLE__ + typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); PFNGLGENBUFFERSPROC gl_GenBuffers;
@@ -155,6 +157,8 @@ typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); PFNGLUNIFORMMATRIX4FVPROC gl_UniformMatrix4fv;
+#endif + void initExtensionEntries(void) { gl_GenBuffers = (PFNGLGENBUFFERSPROC) glutGetProcAddress ("glGenBuffers");
to allow these to be defined, I still get the compile errors...
gcc -DHAVE_CONFIG_H -I. -I../../.. -I/sw/include -I../../../ include -I/usr/X11R6/include -O3 -DTARGET_HOST_POSIX_X11 -c -o smooth_opengl3-smooth_opengl3.o `test -f 'smooth_opengl3.c' || echo './'`smooth_opengl3.c smooth_opengl3.c: In function ‘initExtensionEntries’: smooth_opengl3.c:164: error: ‘gl_GenBuffers’ undeclared (first use in this function) smooth_opengl3.c:164: error: (Each undeclared identifier is reported only once smooth_opengl3.c:164: error: for each function it appears in.) smooth_opengl3.c:165: error: ‘gl_BindBuffer’ undeclared (first use in this function) smooth_opengl3.c:166: error: ‘gl_BufferData’ undeclared (first use in this function) smooth_opengl3.c:167: error: ‘gl_CreateShader’ undeclared (first use in this function) smooth_opengl3.c:168: error: ‘gl_ShaderSource’ undeclared (first use in this function) smooth_opengl3.c:169: error: ‘gl_CompileShader’ undeclared (first use in this function) smooth_opengl3.c:170: error: ‘gl_CreateProgram’ undeclared (first use in this function) smooth_opengl3.c:171: error: ‘gl_AttachShader’ undeclared (first use in this function) smooth_opengl3.c:172: error: ‘gl_LinkProgram’ undeclared (first use in this function) smooth_opengl3.c:173: error: ‘gl_UseProgram’ undeclared (first use in this function) smooth_opengl3.c:174: error: ‘gl_GetShaderiv’ undeclared (first use in this function) smooth_opengl3.c:175: error: ‘gl_GetShaderInfoLog’ undeclared (first use in this function) smooth_opengl3.c:176: error: ‘gl_GetProgramiv’ undeclared (first use in this function) smooth_opengl3.c:177: error: ‘gl_GetProgramInfoLog’ undeclared (first use in this function) smooth_opengl3.c:178: error: ‘gl_GetAttribLocation’ undeclared (first use in this function) smooth_opengl3.c:179: error: ‘gl_VertexAttribPointer’ undeclared (first use in this function) smooth_opengl3.c:180: error: ‘gl_EnableVertexAttribArray’ undeclared (first use in this function) smooth_opengl3.c:181: error: ‘gl_GetUniformLocation’ undeclared (first use in this function) smooth_opengl3.c:182: error: ‘gl_UniformMatrix4fv’ undeclared (first use in this function) make: *** [smooth_opengl3-smooth_opengl3.o] Error 1
Thanks in advance for any advice. Jack _______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/xquartz-dev