Always draw a black line

Hi, all.

I have piece of code like this:

glEnable(GL_LINE_SMOOTH);
//glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glLineWidth(myWidth);

    glBegin(GL_LINES);
    glColor3fv(1.0, 1.0, 1.0);
    glVertex3fv(centerPoint.getValue());
    glVertex3fv(leadingPoint.getValue());
    glEnd();

just try to draw a white line:
The problem is, I always get a black line. Anybody know what could be the reason? anything related to the shaders I am using?

Originally posted by kewuwsi:
anything related to the shaders I am using?
If you are using shaders, what happens if you disable them? Without shaders you line should be white. If not, try enabling GL_COLOR_MATERIAL (just to be on the sure side) and make sure your color matrix is identity.

Make sure shaders are disabled.
Make sure blending is disabled.
Make sure you don’t have textures enabled on any other texture unit (if you use multitexturing and you have shader disabled).

cool, disabling other textures make it work. I used glEnable(Texture2D) for every textures. Now, I removed all of them, it works just great! But could please explain why?

appreciate it !

When not using shaders, all texture units that are enabled will use their textures to affect rendered image.
So, glEnable(TEXTURE_2D) does not enable texturing in general - it enables texturing on one texture unit. Each textue unit can be “activated” or “deactivated” independently.

If you use shader, you don’t have to enable textures. You only need to bind textures to texture units.
That’s because in shader you read textures yourself from texture units you want.

great!, clear!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.