… | |
… | |
135 | template<GLenum type> |
135 | template<GLenum type> |
136 | void entity_opengl2d<type>::draw (const draw_context &ctx) |
136 | void entity_opengl2d<type>::draw (const draw_context &ctx) |
137 | { |
137 | { |
138 | glBegin (type); |
138 | glBegin (type); |
139 | |
139 | |
|
|
140 | if (ctx.mode == draw_context::LIGHTED) |
|
|
141 | { |
|
|
142 | glMaterialfv (GL_FRONT, GL_DIFFUSE, (GLfloat *)&m.diffuse); |
|
|
143 | glMaterialfv (GL_FRONT, GL_SPECULAR, (GLfloat *)&m.specular); |
|
|
144 | glMaterialfv (GL_FRONT, GL_EMISSION, (GLfloat *)&m.emission); |
|
|
145 | glMaterialf (GL_FRONT, GL_SHININESS, m.shininess); |
|
|
146 | } |
|
|
147 | |
140 | for (iterator i = begin (); i < end (); ++i) |
148 | for (iterator i = begin (); i < end (); ++i) |
141 | { |
149 | { |
142 | if (ctx.mode == draw_context::LIGHTED) |
150 | if (ctx.mode == draw_context::LIGHTED) |
143 | { |
151 | { |
144 | glColor3fv ((GLfloat *)&i->c); |
|
|
145 | glTexCoord2fv ((GLfloat *)&i->t); |
152 | glTexCoord2fv ((GLfloat *)&i->t); |
146 | glNormal3fv ((GLfloat *)&i->n); |
153 | glNormal3fv ((GLfloat *)&i->n); |
147 | } |
154 | } |
148 | |
155 | |
149 | glVertex3fv ((GLfloat *)&i->p); |
156 | glVertex3fv ((GLfloat *)&i->p); |