MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / draw_object

Function draw_object

demos/glthreadsint.c:180–243  ·  view source on GitHub ↗

draw a colored cube */

Source from the content-addressed store, hash-verified

178
179/* draw a colored cube */
180static void
181draw_object(void)
182{
183 glPushMatrix();
184 glScalef(0.75, 0.75, 0.75);
185
186 glColor3f(1, 0, 0);
187
188 if (Texture) {
189 glBindTexture(GL_TEXTURE_2D, TexObj);
190 glEnable(GL_TEXTURE_2D);
191 }
192 else {
193 glDisable(GL_TEXTURE_2D);
194 }
195
196 glBegin(GL_QUADS);
197
198 /* -X */
199 glColor3f(0, 1, 1);
200 glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
201 glTexCoord2f(1, 0); glVertex3f(-1, 1, -1);
202 glTexCoord2f(1, 1); glVertex3f(-1, 1, 1);
203 glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
204
205 /* +X */
206 glColor3f(1, 0, 0);
207 glTexCoord2f(0, 0); glVertex3f(1, -1, -1);
208 glTexCoord2f(1, 0); glVertex3f(1, 1, -1);
209 glTexCoord2f(1, 1); glVertex3f(1, 1, 1);
210 glTexCoord2f(0, 1); glVertex3f(1, -1, 1);
211
212 /* -Y */
213 glColor3f(1, 0, 1);
214 glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
215 glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
216 glTexCoord2f(1, 1); glVertex3f( 1, -1, 1);
217 glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
218
219 /* +Y */
220 glColor3f(0, 1, 0);
221 glTexCoord2f(0, 0); glVertex3f(-1, 1, -1);
222 glTexCoord2f(1, 0); glVertex3f( 1, 1, -1);
223 glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
224 glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
225
226 /* -Z */
227 glColor3f(1, 1, 0);
228 glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
229 glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
230 glTexCoord2f(1, 1); glVertex3f( 1, 1, -1);
231 glTexCoord2f(0, 1); glVertex3f(-1, 1, -1);
232
233 /* +Y */
234 glColor3f(0, 0, 1);
235 glTexCoord2f(0, 0); glVertex3f(-1, -1, 1);
236 glTexCoord2f(1, 0); glVertex3f( 1, -1, 1);
237 glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);

Callers 1

draw_loopFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected