I used 3d texture in my program, but when I wanted to port the program to OS X I encountered some problems:

in windows, what I did was include glext.h and started using something like:


and later

glTexImage3D = (glTexImage3DEXTProcPtr)wglGetProcAddress(“glTexImage3D”);

but on OS X, from here I learnt that I need to define GL_GLEXT_FUNCTION_POINTERS in order to enable function pointers, I tried to define it like this:

#include <GLUT/glut.h>
#include <OpenGL/glext.h>

because defining it before including glut generated more error…also I replaced PFNGLTEXIMAGE3DPROC with glTexImage3DEXTProcPtr, but it still gives me “error: glTexImage3DEXTProcPtr does not name a type”, I don’t know where went wrong

Also, I know that wglGetProcAddress doesn’t work on OS X, so how should this be implemented?

Thank you guys! Merry Christmas!

I have ported a software from Windows to MacOS X and it seams actually really easy as far as MacOS X already provide an OpenGL 2 implementation. Under Windows I use GLEW to load every functions but under MacOS I just had to replace my #include <GL/glew.h> by #include <OpenGL/gl.h> (Do not remember the actual name of this include but I guest you will find it easely). In conclusion, no need of GetProcessAddress or whatever, just use the function!

This was done on MacOS 10.4… could different with previous release I think.

Merry Christmas too!

You haven’t needed to load function pointers since Mac OS X 10.2, at least. They’re “weak linked”, meaning that your application will run (but the function will be NULL) even if the user is running on an OS version without that function.

For compatibility with Windows/Linux code though, it’s sometimes useful to use them.

<GLUT/glut.h> includes <OpenGL/gl.h> already, so by the time you define GL_GLEXT_FUNCTION_POINTERS it’s too late. Make sure this is defined before all gl.h is first included.

wow, got that working! thx! turns out I dont need to include glext.h at all, let alone defining GL_GLEXT_FUNCTION_POINTERS

OS X has made it so easy…

one more thing to ask u sadcookie, so I followed ur way to add Cocoa target in order to start a OpenGL application but I found the console missing, is there anyway I can get the console display out so I can get some information from standard output?

Pressing cmd-shift-R (“Run Log”) should bring it up, I think. There’s a menu item somewhere too.


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.