Problem in texturing

Hello everyone,

I am having a tough time while applying texture to some of my components in my 3D. Following is the detail of problem:

When i do glEnable(GL_TEXTURE_2D);

It does apply the required texture, but at the same time, it also changes the color of all my components in my 3D space. What i am doing wrong??

When you want to apply textures, enable it.
When you don’t want to apply them (pure colors, or materials) just disable them (glDisable(GL_TEXTURE_2D)). The concept is simple. :slight_smile:
So, before drawing other not-textured objects just disable texturing and everything will be like before.

Thanks Aleksandar, did the same thing and it is working fine now. By the way, does the same thing applies to GL_BLEND. Like when i enable the GL_BLEND, it is making everything as translucent.

By glEnable(GL_BLEND) you do enable blending, but achieving transparency is much harder task than texturing. You should set blending function and blending equation (glBlendFunc(), glBlendEquation()), as well as draw objects in back-to-front order. It could be challenging to reorder visible objects in each frame. There are several OIT techniques, like: Depth Peeling, Reverse Depth Peeling, Dual Depth Peeling, Stencil Routed A-Buffer, etc. But I guess those techniques are out of the scope of your question. :slight_smile: