本文整理汇总了Python中display.Display.set_flip_option方法的典型用法代码示例。如果您正苦于以下问题:Python Display.set_flip_option方法的具体用法?Python Display.set_flip_option怎么用?Python Display.set_flip_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类display.Display
的用法示例。
在下文中一共展示了Display.set_flip_option方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Display
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import set_flip_option [as 别名]
#--*-- coding:UTF-8 --*--
from __init__ import * #LOAD DEPENDENCIES FROM FILE __init__.py
from display import Display
from viewPorts import *
pygame.init()
SCREEN_SIZE = [1024, 768]
window = Display(SCREEN_SIZE)
_2D_view_= ViewPort2D((0,0, 1024, 768), 45)
_2D_view_.set_viewport()
while True:
window.set_flip_option()
window.get_events()
示例2: __init__
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import set_flip_option [as 别名]
#.........这里部分代码省略.........
glVertex3f( 1, 1, -1)
glVertex3f( 1, 1, 1)
glVertex3f( -1, 1, 1)
glNormal3f(-1,0,0)
glVertex3f( -1, -1, -1)
glVertex3f( -1, 1, -1)
glVertex3f( -1, 1, 1)
glVertex3f( -1, -1, 1)
glNormal3f(1,0,0)
glVertex3f( 1, -1, -1)
glVertex3f( 1, 1, -1)
glVertex3f( 1, 1, 1)
glVertex3f( 1, -1, 1)
glEnd()
glEndList()
self.texture=glGenTextures(1)
glActiveTexture(GL_TEXTURE0);
glBindTexture( GL_TEXTURE_2D, self.texture );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
self.texdata = numpy.zeros((256,256,4))
#Efeito em volta dos cubos
for i in range(0,256):
x=(i-128.1)/128.0
for j in range(0,256):
y = (j-128.1)/128.0
if ((x*x+y*y>0.9) | (x*x+y*y<0.3)):
self.texdata[i][j][0] = 0
self.texdata[i][j][1] = 0
self.texdata[i][j][2] = 0
self.texdata[i][j][3] = 0
else:
self.texdata[i][j][0] = 1
self.texdata[i][j][1] = 1
self.texdata[i][j][2] = 1
self.texdata[i][j][3] = 1
glTexImage2Df(GL_TEXTURE_2D, 0,GL_RGBA,0,GL_RGBA,self.texdata)
self.loc = glGetUniformLocation(self.program,"projMap");
glUniform1i(self.loc, 0)
glEnable(GL_DEPTH_TEST)
while True:
self.t += 1
ppos=[sin(self.t/260.0)*3,cos(self.t/340.0)*8,0]
palpha=self.t
pbeta=self.t/3.0
glMatrixMode(GL_TEXTURE);
glLoadIdentity()
glRotate(-palpha,0,1,0);
glRotate(-pbeta ,1,0,7);
glTranslate(-ppos[0],-ppos[1],-ppos[2])
glLightfv(GL_LIGHT0,GL_POSITION,[ppos[0],ppos[1],ppos[2]]);
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(90,1,0.01,1000)
gluLookAt(sin(self.t/500.0)*4,sin(self.t/320.0)*3+8,cos(self.t/400.0)*5,0,0,1,0,1,0)
glClearColor(0.0, 9.5, 0.0, 1.0)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glTranslate(ppos[0],ppos[1],ppos[2])
glBegin(GL_TRIANGLES)
glVertex3f(1,0,0)
glVertex3f(0,1,0)
glVertex3f(0,0,1)
glEnd()
glColor3f(1,1,1)
glLoadIdentity()
for i in range(-1,5):
for j in range(-1,8):
for k in range(-1,8):
glPushMatrix()
glTranslate(i*5,j*8,k*5)
glScale(1,1,1)
glCallList(1)
glPopMatrix()
time.sleep(0.0001);
self.frames_per_second.tick(90)
self.display.get_events()
self.display.set_flip_option()
示例3: range
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import set_flip_option [as 别名]
for i in range(0,150):
r=9.5
d=1
if (i%2==0):
glTexCoord2f(0,i);
glVertex3f( cos(i/r), -2.5+i*0.05, sin(i/r));
# glVertex3f( cos(i/r)*pulse, -2.5+i*0.05, sin(i/r)*pulse);
else:
glTexCoord2f(1,i);
glVertex3f( cos(i/r+3.14), -2.5+i*0.05+d, sin(i/r+3.14));
# glVertex3f( cos(i/r+3.14)*pulse, -2.5+i*0.05+d+pulse*1, sin(i/r+3.14)*pulse);
glEnd();
glFlush();
glDeleteTextures(texture);
if __name__ == '__main__':
t=0
display = Display(SCREEN_SIZE)
ViewPort3D((0,0, SCREEN_SIZE[0], SCREEN_SIZE[1]), 45).set_viewport()
frames_per_second = pygame.time.Clock()
while True:
t=t+1
DNA()
time.sleep(0.001);
display.get_events()
display.set_flip_option()