ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/entity.C
(Generate patch)

Comparing libgender/entity.C (file contents):
Revision 1.13 by root, Sun Oct 3 05:10:45 2004 UTC vs.
Revision 1.14 by root, Sun Oct 3 05:53:09 2004 UTC

144} 144}
145 145
146template<GLenum type> 146template<GLenum type>
147void entity_opengl2d<type>::draw (draw_context &ctx) 147void entity_opengl2d<type>::draw (draw_context &ctx)
148{ 148{
149 glBegin (type); 149 if (!list)
150 {
151 list = glGenLists (1);
152 glNewList (list, GL_COMPILE);
150 153
151 if (ctx.mode == draw_context::LIGHTED) 154 glBegin (type);
152 { 155
153 glMaterialfv (GL_FRONT, GL_DIFFUSE, (GLfloat *)&m.diffuse); 156 glMaterialfv (GL_FRONT, GL_DIFFUSE, (GLfloat *)&m.diffuse);
154 glMaterialfv (GL_FRONT, GL_SPECULAR, (GLfloat *)&m.specular); 157 glMaterialfv (GL_FRONT, GL_SPECULAR, (GLfloat *)&m.specular);
155 glMaterialfv (GL_FRONT, GL_EMISSION, (GLfloat *)&m.emission); 158 glMaterialfv (GL_FRONT, GL_EMISSION, (GLfloat *)&m.emission);
156 glMaterialf (GL_FRONT, GL_SHININESS, m.shininess); 159 glMaterialf (GL_FRONT, GL_SHININESS, m.shininess);
157 } 160
158
159 for (iterator i = begin (); i < end (); ++i) 161 for (iterator i = begin (); i < end (); ++i)
160 {
161 if (ctx.mode == draw_context::LIGHTED)
162 { 162 {
163 glTexCoord2fv ((GLfloat *)&i->t); 163 glTexCoord2fv ((GLfloat *)&i->t);
164 glNormal3fv ((GLfloat *)&i->n); 164 glNormal3fv ((GLfloat *)&i->n);
165 glVertex3fv ((GLfloat *)&i->p);
165 } 166 }
166 167
167 glVertex3fv ((GLfloat *)&i->p); 168 glEnd ();
169 glEndList ();
168 } 170 }
169 171
170 glEnd (); 172 glCallList (list);
171} 173}
172 174
173template<GLenum type> 175template<GLenum type>
174void entity_opengl1d<type>::show (const sector &sec) 176void entity_opengl1d<type>::show (const sector &sec)
175{ 177{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines