How to convert ofImage to GLuint?

Hey all, I’m very new to C++ and OF (I work in AS3 mostly) so pardon the ignorance. Basically the problem I’m having is that I can load a JPG into an ofImage easily, but I can’t for the life of me figure out how to convert it to a GLuint so I can use it as a 2D texture in openGL. Any advice/guidence would be greatly appreciated.

if you have an image, like “myImage” you can do:


getTextureReference() returns a reference to the texture inside the object
getTextureData() returns a struct that has info about the texture
textureID is a “unsigned integer” which is the texture ID, which you can treat or cast as a GLuint.

you can also do stuff like:


as well.

one important thing to note is that textures can be one of two types – normal or non power of two. We handle this internally fine, but if you bind a texture by hand, as you are trying to do, it’s usually useful to know why type it is - as the way you deal with coordinates inside the texture vary based on what type of texture it is.

hope that helps!

take care,

Thanks! that does make sense, some principals from AS3 carry over. I think I’m setting up my textures correctly now, but for some reason my openGL skybox isn’t rendering correctly (I set the color to black but the sky is still showing up grey). hmm, will have to play around with it a bit more. thanks again tho