Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- from OpenGL.GL import *
- from OpenGL.GLU import *
- from OpenGL.GLUT import *
- from numpy import *
- import sys
- def init():
- glClearColor(0.0, 0.0, 0.0, 1.0)
- gluOrtho2D(-2.0, 2.0, -2.0, 2.0)
- def plotfunc():
- glClear(GL_COLOR_BUFFER_BIT)
- glColor3f(0.0,0.0,0.0)
- glPointSize(1.0)
- glBegin(GL_POINTS)
- for a in arange(0.1,2.0,0.1):
- for t in arange(-200.0,200.0,0.005):
- x = sin(0.99*t)-0.7*cos(3.01*t)
- y = cos(1.01*t)+0.1*sin(15.03*t)
- glColor3f(sin(t)**2,cos(t)**2,sin(t)**2/2+cos(t)**2/2)
- glVertex2f(x,y)
- glEnd()
- glFlush()
- def main():
- glutInit(sys.argv)
- glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB)
- glutInitWindowPosition(0,0)
- glutInitWindowSize(1366,768)
- glutCreateWindow("Function Plotter")
- glutDisplayFunc(plotfunc)
- init()
- glutMainLoop()
- main()
Advertisement
Add Comment
Please, Sign In to add comment