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.} =
|
proc display() {.cdecl.} =
|
||||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) # Clear color and depth buffers
|
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) # Clear color and depth buffers
|
||||||
glMatrixMode(GL_MODELVIEW) # To operate on model-view matrix
|
glMatrixMode(GL_MODELVIEW) # To operate on model-view matrix
|
||||||
|
|
||||||
# Render a color-cube consisting of 6 quads with different colors
|
# Render a color-cube consisting of 6 quads with different colors
|
||||||
glLoadIdentity() # Reset the model-view matrix
|
glLoadIdentity() # Reset the model-view matrix
|
||||||
glTranslatef(1.5, 0.0, -7.0) # Move right and into the screen
|
glTranslatef(1.5, 0.0, -7.0) # Move right and into the screen
|
||||||
|
|
||||||
glBegin(GL_QUADS) # Begin drawing the color cube with 6 quads
|
glBegin(GL_QUADS) # Begin drawing the color cube with 6 quads
|
||||||
|
|
||||||
# Top face (y = 1.0f)
|
# Top face (y = 1.0f)
|
||||||
# Define vertices in counter-clockwise (CCW) order with normal pointing out
|
# Define vertices in counter-clockwise (CCW) order with normal pointing out
|
||||||
glColor3f(0.0, 1.0, 0.0) # Green
|
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)
|
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
|
glEnd() # End of drawing
|
||||||
|
|
||||||
glutSwapBuffers() # Swap the front and back frame buffers (double buffering)
|
glutSwapBuffers() # Swap the front and back frame buffers (double buffering)
|
||||||
|
|
||||||
proc reshape(width: GLsizei, height: GLsizei) {.cdecl.} =
|
proc reshape(width: GLsizei, height: GLsizei) {.cdecl.} =
|
||||||
# Compute aspect ratio of the new window
|
# Compute aspect ratio of the new window
|
||||||
if height == 0:
|
if height == 0:
|
||||||
|
|
@ -74,16 +74,16 @@ proc reshape(width: GLsizei, height: GLsizei) {.cdecl.} =
|
||||||
glLoadIdentity() # Reset
|
glLoadIdentity() # Reset
|
||||||
# Enable perspective projection with fovy, aspect, zNear and zFar
|
# Enable perspective projection with fovy, aspect, zNear and zFar
|
||||||
gluPerspective(45.0, width / height, 0.1, 100.0)
|
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)
|
loadExtensions()
|
||||||
glutReshapeFunc(reshape)
|
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
|
glClearColor(0.0, 0.0, 0.0, 1.0) # Set background color to black and opaque
|
||||||
glClearDepth(1.0) # Set background depth to farthest
|
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
|
glDepthFunc(GL_LEQUAL) # Set the type of depth-test
|
||||||
glShadeModel(GL_SMOOTH) # Enable smooth shading
|
glShadeModel(GL_SMOOTH) # Enable smooth shading
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Nice perspective corrections
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Nice perspective corrections
|
||||||
|
|
||||||
glutMainLoop()
|
glutMainLoop()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue