Setting the index data of a VBO - "ofIndexType"?

I’ve got a VBO, a vector containing vertex data as a list of floats, and a vector containing index data as a list of ints.

std::vector<float> vertices;
std::vector<int> edges;

With the ofVbo class, this works:

vbo.setVertexData(&vertices[0], 3, vertices.size(), GL_STATIC_DRAW, 0);

However, this gives me an error:

vbo.setIndexData(&edges[0], edges.size(), GL_STATIC_DRAW);
Error	C2664	'void ofVbo::setIndexData(const ofIndexType *,int,int)': cannot convert argument 1 from '_Ty *' to 'const ofIndexType *'
Error (active)	E0167	argument of type "GLint *" is incompatible with parameter of type "const ofIndexType *

I’ve tried changing the type of edges from int to UINT16, short and ushort and so on, but I can’t see how to get from int to ofIndexType, even though presumably indices need to be an unsigned integer.

Thanks in advance!

I think you need to change the datatype of your edges vector e.g.

std::vector<const ofIndexType> edges;

Or you could just cast when you call setIndexData()

vbo.setIndexData((const ofIndexType *)&edges[0], edges.size(), GL_STATIC_DRAW);

I am not sure if the const is needed for either.

The second one works fine, thanks- I’d tried changing the data type of the vector, but I’m loading the data from a JSON file I’ve generated, and that shifted the problem to where I parse the JSON file.