Problems with function glColor between glBegin and glEnd

Hi everyone:

I’m working with opengl interface in a comercial CAD system calles solid edge.

Normally if I use the function glColor between glBegin and glEnf it should work attributing the indicated rgb to the actual color, but in the add-in I’m developing for solid edge this does not work.

Does any one faced some similar problem?
Is it something in my opengl code that is bat implemented or can it be of the solid edge interpreter?

Thanks!!!

Sofia Gameiro

Sofia, why dont you post some code?
Does you program work as expected when you call glColor outside the glBegin and glEnd?

Yes, it does.

Here is a simple exemple of a code that works and one that does not:

this one works:

pIGL->glColor3ub(r,g,b);

// triangle 1
pIGL->glBegin(GL_TRIANGLE_STRIP);

v = v1;
pIGL->glVertex3dv(v); 
v = v2;
pIGL->glVertex3dv(v); 
v = v3;
pIGL->glVertex3dv(v); 

pIGL->glEnd();

this one does not work:

// triangle 1
pIGL->glBegin(GL_TRIANGLES);

pIGL->glColor3ub(r,g,b);

v = v1;
pIGL->glVertex3dv(v); 
v = v2;
pIGL->glVertex3dv(v); 
v = v3;
pIGL->glVertex3dv(v); 

pIGL->glEnd();

in the first one each triangle strip that a draw ( in this case each has only one triangle but that’s not the matter) has is own color defined by the r,g,b values and in the second one no color is attributed to the triangles.

Do you know why it may be?

Originally posted by mancha:
Sofia, why dont you post some code?
Does you program work as expected when you call glColor outside the glBegin and glEnd?

I’m sorry , in the second code, where it says GL_TRIANGLES should be GL_TRIANGLE_STRIP, that does not affect the problem i’m referring to.

Originally posted by Sofia Gameiro:
[b]Yes, it does.

Here is a simple exemple of a code that works and one that does not:

this one works:

pIGL->glColor3ub(r,g,b);

// triangle 1
pIGL->glBegin(GL_TRIANGLE_STRIP);

v = v1;
pIGL->glVertex3dv(v);
v = v2;
pIGL->glVertex3dv(v);
v = v3;
pIGL->glVertex3dv(v);

pIGL->glEnd();

this one does not work:

// triangle 1
pIGL->glBegin(GL_TRIANGLES);

pIGL->glColor3ub(r,g,b);

v = v1;
pIGL->glVertex3dv(v);
v = v2;
pIGL->glVertex3dv(v);
v = v3;
pIGL->glVertex3dv(v);

pIGL->glEnd();

in the first one each triangle strip that a draw ( in this case each has only one triangle but that’s not the matter) has is own color defined by the r,g,b values and in the second one no color is attributed to the triangles.

Do you know why it may be?

[/b]