1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| // Draw a rectangular parallelogram.
// Dessine un parallelipipede rectangle.
PROCEDURE gl_dParallelogramRect(LOCAL rLength is 4-byte real, LOCAL rWidth is 4-byte real, LOCAL rThickness is 4-byte real, LOCAL nARGB is 4-byte int, LOCAL nTexture is 4-byte int)
nAlpha, nRed, nGreen, nBlue are 1-byte unsigned int
zSplitColorARGB(nARGB, nAlpha, nRed, nGreen, nBlue)
glColor4ub(nRed, nGreen, nBlue, nAlpha)
IF nTexture THEN
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, nTexture)
END
// BackFace
glBegin(GL_QUADS)
glTexCoord2f(1.0, 0.0); glVertex3f(-rLength,-rWidth,-rThickness) // Bottom Right Of The Texture And Quad
glTexCoord2f(1.0, 1.0); glVertex3f(-rLength, rWidth,-rThickness) // Top Right Of The Texture And Quad
glTexCoord2f(0.0, 1.0); glVertex3f( rLength, rWidth,-rThickness) // Top Left Of The Texture And Quad
glTexCoord2f(0.0, 0.0); glVertex3f( rLength,-rWidth,-rThickness) // Bottom Left Of The Texture And Quad
glEnd()
// TopFace
glBegin(GL_QUADS)
glTexCoord2f(0.0, 1.0); glVertex3f(-rLength, rWidth,-rThickness) // Top Left Of The Texture And Quad
glTexCoord2f(0.0, 0.0); glVertex3f(-rLength, rWidth, rThickness) // Bottom Left Of The Texture And Quad
glTexCoord2f(1.0, 0.0); glVertex3f( rLength, rWidth, rThickness) // Bottom Right Of The Texture And Quad
glTexCoord2f(1.0, 1.0); glVertex3f( rLength, rWidth,-rThickness) // Top Right Of The Texture And Quad
glEnd()
// BottomFace
glBegin(GL_QUADS)
glTexCoord2f(1.0, 1.0); glVertex3f(-rLength,-rWidth,-rThickness) // Top Right Of The Texture And Quad
glTexCoord2f(0.0, 1.0); glVertex3f( rLength,-rWidth,-rThickness) // Top Left Of The Texture And Quad
glTexCoord2f(0.0, 0.0); glVertex3f( rLength,-rWidth, rThickness) // Bottom Left Of The Texture And Quad
glTexCoord2f(1.0, 0.0); glVertex3f(-rLength,-rWidth, rThickness) // Bottom Right Of The Texture And Quad
glEnd()
// RightFace
glBegin(GL_QUADS)
glTexCoord2f(1.0, 0.0); glVertex3f( rLength,-rWidth,-rThickness) // Bottom Right Of The Texture And Quad
glTexCoord2f(1.0, 1.0); glVertex3f( rLength, rWidth,-rThickness) // Top Right Of The Texture And Quad
glTexCoord2f(0.0, 1.0); glVertex3f( rLength, rWidth, rThickness) // Top Left Of The Texture And Quad
glTexCoord2f(0.0, 0.0); glVertex3f( rLength,-rWidth, rThickness) // Bottom Left Of The Texture And Quad
glEnd()
// LeftFace
glBegin(GL_QUADS)
glTexCoord2f(0.0, 0.0); glVertex3f(-rLength,-rWidth,-rThickness) // Bottom Left Of The Texture And Quad
glTexCoord2f(1.0, 0.0); glVertex3f(-rLength,-rWidth, rThickness) // Bottom Right Of The Texture And Quad
glTexCoord2f(1.0, 1.0); glVertex3f(-rLength, rWidth, rThickness) // Top Right Of The Texture And Quad
glTexCoord2f(0.0, 1.0); glVertex3f(-rLength, rWidth,-rThickness) // Top Left Of The Texture And Quad
glEnd()
// FrontFace
glBegin(GL_QUADS)
glTexCoord2f(0.0, 0.0); glVertex3f(-rLength,-rWidth, rThickness) // Bottom Left Of The Texture And Quad
glTexCoord2f(1.0, 0.0); glVertex3f( rLength,-rWidth, rThickness) // Bottom Right Of The Texture And Quad
glTexCoord2f(1.0, 1.0); glVertex3f( rLength, rWidth, rThickness) // Top Right Of The Texture And Quad
glTexCoord2f(0.0, 1.0); glVertex3f(-rLength, rWidth, rThickness) // Top Left Of The Texture And Quad
glEnd()
IF nTexture THEN glDisable(GL_TEXTURE_2D) |
Partager