You're mixing up 3 different things here:
- OpenGL
- the GL Utilities (GLU) which are not part of OpenGL
- and the GL Extension Wrangler (GLEW)
GLEW and GLU are completely different things and you can not replace one with another.
GL/gl.h
are the base OpenGL headers, which give you OpenGL-1.1 function and token declarations, any maybe more. For anything going beyond version 1.1 you must use the OpenGL extension mechanism. Since this is a boring and tedious task, that has been automatized by the GLEW project, which offer all the dirty details packed up in a easy to use library. The declarations of this library are found in the header file GL/glew.h
. Since OpenGL extensions don't make sense without basic OpenGL, the GLEW header implicitly includes the regular OpenGL header, so as of including GL/glew.h
you no longer need to include GL/gl.h
.
Then there's GLU, a set of convenience methods, which BTW are seriously outdated and should not be used in any modern OpenGL program. There's no modern GLU, so just forget about it. Anyway, it's declarations are made available by the header GL/glu.h
(the one you were asking about).
The errors you get have nothing to do with include files though. Those are linker errors. Just including the declarations is only half of the job. The other half is linking the actual definitions and those are not in the header by the library file; libglew.so
or libglew.a
on a *nix OS, glew.lib
or glew32.lib
or glews.lib
or glew32s.lib
on Windows. If not using the static versions (those without the 's') you also must have installed the right DLL.
So to use GLEW you need to include the header and add it to the list of libraries in the linker options. Also you must call glewInit();
once you've obtained a OpenGL context in your program.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…