   Blending and GL_LIGHTING. Am I missing something?
  This problem has bothered me troughout the night. Now I'm slowly starting to think about changing careers..The dataI'm trying to draw a triangle strip. I have vertex position data(XYZ), vertex color (RGBA) , normal data (XYZ), and primitive indices. The alpha color in the color array is always 0.5, so the whole object should be "a bit transparent". I also need proper lighting on the object. The problem glDisable(GL_LIGHTING);  //yes, I know, bare with me! glEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(GL_FLOAT,0,norm);glDisableClientState(GL_TEXTURE_COORD_ARRAY);glBindTexture(GL_TEXTURE_2D,0);glEnableClientState(GL_COLOR_ARRAY);glColorPointer(4,GL_FLOAT,0,color);glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3,GL_FLOAT,0,vert);glEnable(GL_BLEND);glDepthMask(GL_FALSE);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);glDrawElements(GL_TRIANGLE_STRIP,Nface,GL_UNSIGNED_INT,index);glDepthMask(GL_TRUE);glDisable(GL_BLEND); The code above renders properlly colored and semi-transparent, but, obviously, not lit. However,usingglEnable(GL_LIGHTING);   //this time I enable lightingglEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(GL_FLOAT,0,norm);glDisableClientState(GL_TEXTURE_COORD_ARRAY);glBindTexture(GL_TEXTURE_2D,0);glEnableClientState(GL_COLOR_ARRAY);glColorPointer(4,GL_FLOAT,0,color); glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3,GL_FLOAT,0,vert);glEnable(GL_BLEND);glDepthMask(GL_FALSE);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);glDrawElements(GL_TRIANGLE_STRIP,Nface,GL_UNSIGNED_INT,index);glDepthMask(GL_TRUE);glDisable(GL_BLEND); Now on this code, w/ GL_LIGHTING enabled. ALL of the mesh is now a "greish color" (yes, the light is propelly positioned) and what is worst... not transparent! I'm slowly running out of ideeas, patience and coffee. Anyone out there that can think of someting?[edit] a bunch of typos... too much coffee I guess    Quidquid latine dictum sit, altum viditur[edited by - Radu094 on February 11, 2004 2:49:39 AM][edited by - Radu094 on February 11, 2004 2:49:55 AM]
  Lighting and colors are mutually exclusive, as lighting replaces the current color by the color computed from the lighting equation.Just using OpenGL 1.1 and no texture, i think you could do it by playing with the alpha value of your light and material colors. Might be a bit tricky but this should work.Y.;quote:Original post by Ysaneya  Lighting and colors are mutually exclusive, as lighting replaces the current color by the color computed from the lighting equation. Argh.. I was afraid of that. Indeed usingglMaterialfv( GL_FRONT, GL_DIFFUSE..)I can set a "global" alpha value, but not per vertex. Well, I guess I have to add texture afterall..thanks..;  You may be able to set per-vertex alpha if you use glEnable(GL_COLOR_MATERIAL) (and related properties) to use the vertex colours instead of a material setup. Not quite sure how lighting and alpha values interact though. ;  well, the way it looks to me now,on glEnable(GL_LIGHTING) alpha values arematerial_diffuse.alpha * light_diffuse.alpha * texture.alpha(assuming one uses a texture and modulate env.)on glDisable(GL_LIGHTING),vertex_color.alpha * texture.alphathis seems to be regardles of glEnable(GL_COLOR_MATERIAL), which seems to me a bit weird. I''m searchin through the OpenGL Spec, but I can''t seem to find anything on this matter...