[GtkGLExt] About GL_LINES



Dear gtkglext users,

I'm Teppei Ikeya and a beginner for GTK+ and OpenGL programming.

Now I'm using the gtkglextmm ver 1.1.0 on Fedora Core Linux 3.
I want to draw color lines with light sources (glLight and GL_LIGHTING) .
In that case, we cannot use "glColor()" function for coloring lines
with "glLightfv()" and "glEnable(GL_LIGHTING)", right ?

Therefore I could color the lines using "glMaterial()".
However the color changes if I rotate the objects moving a mouse pointer.
It doesn't seem to depend on the light source
because it doesn't keep even if
I put some light sources on different positions.
It doesn't work in gtkglext 1.0.6, either.
On the other hand, this my setting can hold the line color constant
during object's rotation on the "GLUT" library.

I add my simple code for testing a color line into the sample source
"shapes.cc" which is in "gtkglextmm/examples" directory.
This program cannot stabilize a line as red color on my environment, either.
Is this my program is wrong or my environment is bad ??

Could you teach me correct writing style for keeping the line's color
in GTKGLEXT library.

Thank you very much in advance for your kind cooperation,
Teppei


That program is as following,

<shapes.cc>

--------------- from LINE 499 -------------------------
   /* Teapot */
   glNewList(m_ListBase + TEAPOT, GL_COMPILE);
      // ----- The following lines were add by T.Ikeya ----------
// ----- from here --------------------------------- // * red color setting
     GLfloat ambient[4] =  {1.0000, 0.00000, 0.00000, 1.0};
     GLfloat diffuse[4] =  {1.0000, 0.00000, 0.00000, 1.0};
     GLfloat specular[4] = {1.0000, 0.00000, 0.00000, 1.0};
     GLfloat shininess=0.6;
     // * material color setting
     glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
     glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
     glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
     glMaterialf(GL_FRONT, GL_SHININESS, shininess * 128.0);
     glBegin(GL_LINES);
     glVertex3d(0, 0, 0); glVertex3d(10.0, 10.0, 10.0);
     glEnd();
     // ------ to here -----------------------------------
     gldrawable->draw_teapot(true, 1.0);
   glEndList();




-----------------
Teppei Ikeya




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]