当前位置: 首页>>代码示例>>Python>>正文


Python Display.get_events方法代码示例

本文整理汇总了Python中display.Display.get_events方法的典型用法代码示例。如果您正苦于以下问题:Python Display.get_events方法的具体用法?Python Display.get_events怎么用?Python Display.get_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在display.Display的用法示例。


在下文中一共展示了Display.get_events方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Display

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import get_events [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()
开发者ID:PythonProjects,项目名称:PyOpenGL-Example,代码行数:18,代码来源:02+-+2DSceneTest.py

示例2: __init__

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import get_events [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()
开发者ID:PythonProjects,项目名称:PyOpenGL-Example,代码行数:104,代码来源:07+-+3D-+ColorTest+++MultiBlocks.py

示例3: glBegin

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import get_events [as 别名]
    glBegin(GL_TRIANGLE_STRIP);

    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()
开发者ID:PythonProjects,项目名称:PyOpenGL-Example,代码行数:33,代码来源:06+-+3D-DNA.py


注:本文中的display.Display.get_events方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。