How to go from Texture Id to Texture object?

When I use glGenTextures(). It only returns an int and not the texture itself. I want to keep track of all textures in an array but I have no way of storing it because well…it only returns an integer. How do I go about doing this? Do I even need to do this?

glGenTextures() is only supposed to return an integer. It generates a unique id you can use for a new texture object. The “texture object” is an object stored by OpenGL on the graphics card, it is not the same thing as any Java type named Texture (these would just wrap an integer received from glGenTextures() anyway).

Why can’t you just store the texture id in the array?

I don’t think he even understand how textures or anything else in OpenGL work. @OP, read some tutorials first before asking RTFM-related questions :slight_smile:

As far as OpenGL is concerned, that int is the texture, or at least an opaque “handle” to one anyway. The storage associated with the handle is something you allocate and manage separately. This is how all objects in OpenGL work, from textures to buffer objects to shaders. When you want to work with one of these objects, you “bind” them which sets them as the current object you’re working on, and subsequent operations work on the texture or buffer or whatever you have bound. It’s a stateful API, it’s a big pain in the ass, but welcome to OpenGL :stuck_out_tongue: