Reputation: 413
I'm mapping my webcam input(OpenCV) as a texture in a plane in OpenGL. When I execute my program, I noticed that the texture influences to the color of the other existent planes. So, if I have a black texture, I cannot see my 3d scene. Is there a way in OpenGL to avoid that the texture affects the color of the other objects?
The desired result should be that, if the texture is black, only one plane should be black and the others should keep the color previously defined.
Upvotes: 0
Views: 1469
Reputation: 11961
OpenGL API changes the state of the rendering context. A rendering context includes also the actual textures used for producing geometry fragments.
If you enable texturing (i.e. *glEnable(GL_TEXTURE_2D)*), this is applied to all geometries drawn till this state flag is set. You can disable texturing using *glDisable(GL_TEXTURE_2D)*.
Probably you do not disable texturing for other planes, indeed the texture is still applied to other planes.
You should do something like the following:
glEnable(GL_TEXTURE_2D);
...
DrawPlane0(); // This plane is textured
...
glDisable(GL_TEXTURE_2D);
...
DrawPlane1(); // This plane is not textured
Upvotes: 2