Question

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?

Was it helpful?

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.

OTHER TIPS

that is problem with materials in general, they need to be switched before rendering geometry.

simplest way is:

foreach object in renderQueue
    set_material()
    draw_geometry()

and of course we get into some troubles when one objects has to be rendered with two different materials. Another problem is with performance, you usually would sort objects by materials and save the switching (of textures, shaders and other data)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top