Reputation: 11
Till now I've been developing OpenGL apps using GLEW in Visual Studio, but I recently switched to macOS and I'm trying out Xcode.
One very important thing to me is that I want the IDE to show me what parameters a function requires as I type it, and this worked fine on VS. Unfortunately, GLEW defines OpenGL functions with the preprocessor command #define, and Xcode doesn't seem to handle that very well as it doesn't show me the parameter list for those functions. For now I only found a couple of functions that work correctly and they are the glBindTexture(), glBindTexture() and glDrawElements() functions.
Is there a way to let Xcode now that the others( the glBufferData() function, for example) are also functions and that it should go retrieve the parameters list for me?
Upvotes: 0
Views: 283
Reputation: 213258
The main purpose of GLEW is to provide you with function pointers to OpenGL functions. However, on macOS this is not really necessary. You can do something like this:
#if defined __APPLE__
#include <OpenGL/gl3.h>
#else
// Or however you use GLEW
#include <GL/glew.h>
#endif
This will not provide prototypes for anything newer than 4.1, however, so you would have to #ifdef
those parts out. Any functions which are not available at runtime will simply be NULL
, which is basically the same way that GLEW works.
The other alternative is to use an OpenGL loader which provides a more IDE-friendly header. These do exist, I think glLoadGen is an example.
Upvotes: 2