PDA

View Full Version : I canīt disable textures



Kal Mar
05-26-2011, 12:33 PM
Hi everybody

I donít disable my textures. Current, I have three: two 3D texture and one 1D texture, its works with 2 shaders. I like to draw a simple wireframe object, but my program donít work.

Any suggestion?

Here my code,

glUseProgram(0); //disable shaders (it works, I have 2 shaders ?)
glBindTexture(GL_TEXTURE_1D, 0);
glBindTexture(GL_TEXTURE_3D, 0);

//draw with traditional opengl color
glColor3f(1.0, 1.0, 1.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
drawWireframeObject();

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_1D, TexID[0]);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_3D, TexID[1]);

glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, TexID[2]);

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

BionicBytes
05-27-2011, 01:37 AM
but my program don’t work.

What does not work? Can you describe the symptoms (or post a picture)?



glUseProgram(0); //disable shaders (it works, I have 2 shaders ?)
glBindTexture(GL_TEXTURE_1D, 0);
glBindTexture(GL_TEXTURE_3D, 0);
This is not going to do you a lot of good. The same texture unit is being asked to bind two textures (so only the second one will be bound).

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_1D, TexID[0]);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_3D, TexID[1]);

glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, TexID[2]);

Since you have no shader bound you are using fixed functionality. Therefore you need to enable the GL state to use each texture type (1D,2D,3D).
Therefore you need to add glEnable (GL_TEXTURE1D) etc after each glActiveTexture command. Don't forget to disable afterwards when you are done.