[英]How to blit image in pygame while using opengl?
I'm trying to blit my character image using pygame, it works when opengl is not called我正在尝试使用 pygame 对我的角色图像进行 blit,它在未调用 opengl 时有效
pygame.init()
display = pygame.display.set_mode((800, 600))
def draw(self,display):
if self.walkCount + 1 >= 30:
self.walkCount = 0
if self.left:
display.blit(walkLeft[self.walkCount // 6], (int(self.x), int(self.y)))
self.walkCount += 1
elif self.right:
display.blit(walkRight[self.walkCount // 6], (int(self.x), int(self.y)))
self.walkCount += 1
else:
display.blit(standing, (int(self.x), int(self.y)))
pygame.display.flip()
def redraw():
global WalkCount
display.fill((0, 0, 0))
Player1.draw(display)
while True:
redraw()
pygame.quit()
When opengl is called,当 opengl 被调用时,
display = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF | pygame.OPENGLBLIT)
...
def redraw():
global WalkCount
Player1.draw(display)
while True:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
redraw()
pygame.quit()
it doesn't show my character image anymore, how do I fix it?它不再显示我的角色图像,我该如何解决? Am I missing anything?我错过了什么吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.