Die Objkte sind jetzt in einzelnen Dateien. Die Tastatur regelt die Rotation der Szene. lesson2.c wurde in animation.c umbenannt und entsprechend bearbeitet.master
parent
930291bd67
commit
9dd86a266b
@ -0,0 +1,87 @@
|
||||
#include <GL/glut.h> // Header File For The GLUT Library
|
||||
#include <GL/gl.h> // Header File For The OpenGL32 Library
|
||||
#include <GL/glu.h> // Header File For The GLu32 Library
|
||||
|
||||
void DrawCloseBracket(float xrot, float yrot, float zrot, GLuint texture)
|
||||
{
|
||||
glRotatef(xrot, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(yrot, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(zrot, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
// draw a square (quadrilateral)
|
||||
glBegin(GL_QUADS); // start drawing a polygon (4 sided)
|
||||
|
||||
// Down
|
||||
// Front Face (note that the texture's corners have to match the quad's corners)
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.0f, -0.5f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.4f, -0.5f, 0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.2f, 0.0f, 0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.2f, 0.0f, 0.5f); // Top Left Of The Texture and Quad
|
||||
|
||||
// Back Face
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.4f, -0.5f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.2f, 0.0f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.2f, 0.0f, -0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.0f, -0.5f, -0.5f); // Bottom Left Of The Texture and Quad
|
||||
|
||||
// Bottom Face
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.0f, -0.5f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.4f, -0.5f, -0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.4f, -0.5f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, -0.5f, 0.5f); // Bottom Right Of The Texture and Quad
|
||||
|
||||
// Right face
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.4f, -0.5f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.2f, 0.0f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.2f, 0.0f, 0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.4f, -0.5f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
|
||||
// Left Face
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.0f, -0.5f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.0f, -0.5f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.2f, 0.0f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.2f, 0.0f, 0.5f); // Top Left Of The Texture and Quad
|
||||
|
||||
// Up
|
||||
// Front Face (note that the texture's corners have to match the quad's corners)
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.2f, 0.0f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.2f, 0.0f, 0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.4f, 0.5f, 0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, 0.5f, 0.5f); // Top Left Of The Texture and Quad
|
||||
|
||||
// Back Face
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.2f, 0.0f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.4f, 0.5f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, 0.5f, -0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.2f, 0.0f, -0.5f); // Bottom Left Of The Texture and Quad
|
||||
|
||||
// Top Face
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.0f, 0.5f, -0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.0f, 0.5f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.4f, 0.5f, 0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.4f, 0.5f, -0.5f); // Top Right Of The Texture and Quad
|
||||
|
||||
// Left Face
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.2f, -0.0f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.0f, 0.5f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, 0.5f, 0.5f); // Top Left Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.2f, -0.0f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
|
||||
// Right face
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.2f, 0.0f, 0.5f); // Bottom Left Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.2f, 0.0f, -0.5f); // Bottom Right Of The Texture and Quad
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.4f, 0.5f, -0.5f); // Top Right Of The Texture and Quad
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.4f, 0.5f, 0.5f); // Top Left Of The Texture and Quad
|
||||
|
||||
glEnd(); // done with the polygon
|
||||
|
||||
glRotatef(xrot,-1.0f, 0.0f, 0.0f);
|
||||
glRotatef(yrot, 0.0f,-1.0f, 0.0f);
|
||||
glRotatef(zrot, 0.0f, 0.0f,-1.0f);
|
||||
|
||||
}
|
||||
|
||||
/* vim: set et sw=4 ts=4: */
|
||||
|
@ -0,0 +1,6 @@
|
||||
#ifndef CLOSEBRACKET_H
|
||||
#define CLOSEBRACKET_H
|
||||
|
||||
void DrawCloseBracket(float xrot, float yrot, float zrot, GLuint texture);
|
||||
|
||||
#endif
|
@ -1,11 +1,11 @@
|
||||
#ifndef SLASH_H
|
||||
#define SLASH_H
|
||||
#ifndef OPENBRACKET_H
|
||||
#define OPENBRACKET_H
|
||||
|
||||
/*
|
||||
* Draw a textured 2 boxed sharp opening bracket
|
||||
* rotate the object with the 3 args
|
||||
*/
|
||||
|
||||
void DrawOpenBracket(float xrot, float yrot, float zrot);
|
||||
void DrawOpenBracket(float xrot, float yrot, float zrot, GLuint texture);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in new issue