Line coloring??

Started by
5 comments, last by Tree Penguin 20 years, 1 month ago
Hi, i wanted to draw a line with for each vertex a different color, is this impossible using opengl or something as it just wouldn't work for me, if so, is there a way around that (EDIT: besides mapping a texture onto it)? Thanks [edited by - Tree Penguin on March 5, 2004 1:49:00 PM]
Advertisement
Have you tried to set a per-vertex color? It would be interpolated. Is this what you need?

Can you please try to be more clear next time you post something, by spending an extra minute? It''s rather difficult to answer to a problem which is not explained enough.

Previously "Krohm"

Well that''s exactly the problem, this:

glColor3d(0.45,0.45,0.45);
glVertex2i(0,11);
glColor3d(1.0,0.0,0.0);
glVertex2i(m_WindowWidth,11);

gives me a red line, not interpolated.
try using glColor3f instead of glColor3d ?
No, it works neither with glColor3d, glColor3f or glColor3i.
For some reason it blends in with mine, two colors:
    glBegin(GL_LINES);        glColor3f(1.0,1.0,1.0);        glVertex3f(1.0,1.0,-5.0);        glColor3f(0.0,0.0,1.0);        glVertex3f(3.0,3.0,-5.0);    glEnd(); 


What does your initialization for the opengl enivironment code look like?
Have you enabled smooth colour shading?

ie:
glShadeModel(GL_SMOOTH);






--
Cheers,
--
Cheers,
Darren Clark

This topic is closed to new replies.

Advertisement