I'm writing a Texture class to wrap details of OpenGL, and make it as a dll.
There are a lot of const define in OpenGL, like this.
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
I want to wrap them by enum class, like this.
enum class Filter
{
Nearest = GL_NEAREST,
Linear = GL_LINEAR,
NearestMipmapNearest = GL_NEAREST_MIPMAP_NEAREST,
LinearMipmapNearest = GL_LINEAR_MIPMAP_NEAREST,
NearestMipmapLinear = GL_NEAREST_MIPMAP_LINEAR,
LinearMipmapLinear = GL_LINEAR_MIPMAP_LINEAR
};
There is a problem, if I put the enum class in header file, I need to include 3rd OpenGL header when I use my dll.
So I use enum class forward declaration in header and put the definition in cpp file.
// Texture.h
enum class Filter;
But in this case, Compiler can not found members of the enum class when I use enum class out of the cpp file.
How can I wrap them?