Search code examples
openglbindingtexturesshaderwavefront

Binding textures inside shaders


I am coding a wavefront (.obj) loader with VBO's.

When "usemtl" is called, I am thinking about sending textureID together with vertex, texCoord and normal data.

With that texture ID can I bind the texture inside vertex/fragment shader without calling glBindTexture?


Solution

  • With that texture ID can I bind the texture inside vertex/fragment shader without calling glBindTexture?

    No. Textures are not bound to shaders; they're bound to the context.

    If you want to get technical, NV_bindless_texture allows such functionality, but that's NVIDIA-specific.