glMultMatrixf(translate)
が
glRotatef(2 , 0.5 , 1 , 0.25)
に代わっているだけです。
今回もhttp://wisdom.sakura.ne.jp/system/opengl/gl11.htmlを参照させて頂きました。
From my previous example, I made only one change. From glMultMatrixf(translate) to glRotatef(2 , 0.5 , 1 , 0.25). I don't have to use matrix. This would be more straight forward.
import sys
from math import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def disp():
glClear(GL_COLOR_BUFFER_BIT)
glBegin(GL_POLYGON)
glColor3f(1 , 0 , 0)
glVertex2f(-0.9 , -0.9)
glColor3f(0 , 1 , 0)
glVertex2f(0 , 0.9)
glColor3f(0 , 0 , 1)
glVertex2f(0.9 , -0.9)
glEnd()
glFlush()
def timer(value):
glRotatef(2 , 0.5 , 1 , 0.25)
glutPostRedisplay()
glutTimerFunc(50 , timer , 0)
glutInit(sys.argv)
glutInitWindowPosition(100 , 50)
glutInitWindowSize(400 , 300)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
glutCreateWindow("rotate4.py")
glutDisplayFunc(disp)
glutTimerFunc(100 , timer , 0)
glutMainLoop()