PDA

View Full Version : always draw a black line



kewuwsi
10-02-2007, 07:14 AM
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?

Zengar
10-02-2007, 07:35 AM
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.

k_szczech
10-02-2007, 08:30 AM
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).

kewuwsi
10-02-2007, 11:17 AM
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 !

k_szczech
10-02-2007, 03:40 PM
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.

kewuwsi
10-03-2007, 06:53 AM
great!, clear!