I'm currently implementing some code using OpenGL and I've created wrappers for various OpenGL classes. In particular, I have a buffer class that can represent either a vertex array buffer or an element array buffer. To do this, I declared my class in the header like so:
Buffer.h
namespace FE { namespace GL {
enum BufferType {
ARRAY = GL_ARRAY_BUFFER,
ELEMENT = GL_ELEMENT_ARRAY_BUFFER
};
class Buffer {
public:
Buffer(BufferType type);
... rest of class ...
};
}
In my Renderer class, I try to instantiate some buffers as class members:
Renderer.h
...
#include "../GL/Buffer.h"
namespace FE { namespace Render {
class Renderer {
...
private:
GL::Buffer vbo(GL::BufferType::ARRAY);
GL::Buffer element(GL::BufferType::ELEMENT);
};
}}
For some reason, attempting to use the enum this way gives me the errors "syntax error: identifier 'ELEMENT'". Intellisense also warns that "constant 'FE::GL::ELEMENT' is not a type name."
I'm not quite sure why this doesn't work, as before while testing my buffer related code I created buffers in a similar manner (by accessing the enum values with the scope operator).
Any help on how to fix this issue would be appreciated.
vboandelementdata members, or are you trying to createvboandelementmember functions ?GL::Buffer vbo = GL::Buffer(GL::ARRAY);Thanks a bunch!