user82779
user82779

Reputation: 65

std::vector to GLvoid*?

I'm trying to follow this tutorial on OpenGL but instead of loading a raw image I'm using lodePNG.

The problem is that when I cann the function glTexImage2D I get an error on the last argument that it only takes a GLvoid* variable. LodePNG only outputs std::vector as the final image data. I cannot find any other resources on the matter.

How would I go about getting this function to work? The error just simply states it doesn't take this data type.

Upvotes: 0

Views: 1124

Answers (1)

Stian Svedenborg
Stian Svedenborg

Reputation: 1825

vector::data() is your friend.

You will have to pass the raw data from the vector to the glTexImage function.

vector<...> image;
glTexImage2d(..., image.data());

Upvotes: 7

Related Questions