Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # OpenGL example using glut
- import opengl/glut
- import opengl
- import opengl/glu
- proc display() {.cdecl.} =
- glClear(GL_COLOR_BUFFER_BIT)
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity() # Reset the model-view matrix
- glBegin(GL_TRIANGLES) # Begin drawing of triangles
- glColor3f(0.0, 1.0, 0.0)
- glVertex3f( -0.5, -0.5, 0.0)
- glColor3f(1.0, 0.0, 0.0)
- glVertex3f(0, 0.5, 0.0)
- glColor3f(0.0, 0.0, 1.0)
- glVertex3f(0.5, -0.5, 0.0)
- glEnd() # End of drawing
- glutSwapBuffers() # Swap the front and back frame buffers (double buffering)
- var argc: cint = 0
- glutInit()
- glutInitDisplayMode(GLUT_DOUBLE)
- glutInitWindowSize(640, 480)
- glutInitWindowPosition(50, 50)
- discard glutCreateWindow("Modern OpenGL Example")
- glutDisplayFunc(display)
- loadExtensions()
- glClearColor(0.0, 0.0, 0.0, 1.0) # Set background color to black and opaque
- glutMainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement