trailing whitespace
This commit is contained in:
parent
03e5209195
commit
343b930f43
1 changed files with 16 additions and 16 deletions
|
|
@ -7,13 +7,13 @@ import glu
|
|||
proc display() {.cdecl.} =
|
||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) # Clear color and depth buffers
|
||||
glMatrixMode(GL_MODELVIEW) # To operate on model-view matrix
|
||||
|
||||
|
||||
# Render a color-cube consisting of 6 quads with different colors
|
||||
glLoadIdentity() # Reset the model-view matrix
|
||||
glTranslatef(1.5, 0.0, -7.0) # Move right and into the screen
|
||||
|
||||
glBegin(GL_QUADS) # Begin drawing the color cube with 6 quads
|
||||
|
||||
|
||||
# Top face (y = 1.0f)
|
||||
# Define vertices in counter-clockwise (CCW) order with normal pointing out
|
||||
glColor3f(0.0, 1.0, 0.0) # Green
|
||||
|
|
@ -56,11 +56,11 @@ proc display() {.cdecl.} =
|
|||
glVertex3f(1.0, 1.0, 1.0)
|
||||
glVertex3f(1.0, -1.0, 1.0)
|
||||
glVertex3f(1.0, -1.0, -1.0)
|
||||
|
||||
|
||||
glEnd() # End of drawing
|
||||
|
||||
|
||||
glutSwapBuffers() # Swap the front and back frame buffers (double buffering)
|
||||
|
||||
|
||||
proc reshape(width: GLsizei, height: GLsizei) {.cdecl.} =
|
||||
# Compute aspect ratio of the new window
|
||||
if height == 0:
|
||||
|
|
@ -74,16 +74,16 @@ proc reshape(width: GLsizei, height: GLsizei) {.cdecl.} =
|
|||
glLoadIdentity() # Reset
|
||||
# Enable perspective projection with fovy, aspect, zNear and zFar
|
||||
gluPerspective(45.0, width / height, 0.1, 100.0)
|
||||
|
||||
loadExtensions()
|
||||
glutInit()
|
||||
glutInitDisplayMode(GLUT_DOUBLE)
|
||||
glutInitWindowSize(640, 480)
|
||||
glutInitWindowPosition(50, 50)
|
||||
discard glutCreateWindow("OpenGL Example")
|
||||
|
||||
glutDisplayFunc(display)
|
||||
glutReshapeFunc(reshape)
|
||||
loadExtensions()
|
||||
glutInit()
|
||||
glutInitDisplayMode(GLUT_DOUBLE)
|
||||
glutInitWindowSize(640, 480)
|
||||
glutInitWindowPosition(50, 50)
|
||||
discard glutCreateWindow("OpenGL Example")
|
||||
|
||||
glutDisplayFunc(display)
|
||||
glutReshapeFunc(reshape)
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0) # Set background color to black and opaque
|
||||
glClearDepth(1.0) # Set background depth to farthest
|
||||
|
|
@ -91,5 +91,5 @@ glEnable(GL_DEPTH_TEST) # Enable depth testing for z-c
|
|||
glDepthFunc(GL_LEQUAL) # Set the type of depth-test
|
||||
glShadeModel(GL_SMOOTH) # Enable smooth shading
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Nice perspective corrections
|
||||
|
||||
glutMainLoop()
|
||||
|
||||
glutMainLoop()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue