View Full Version : Problem in texturing
04-24-2011, 06:03 AM
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??
04-24-2011, 07:03 AM
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. :)
So, before drawing other not-textured objects just disable texturing and everything will be like before.
04-24-2011, 11:07 AM
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.
04-24-2011, 12:17 PM
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. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.