[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Using PyOpenGL for 2D graphics
On Monday 16 July 2007 02:05:43 pm Matthew Marshall wrote:
> I'll also throw in a mention of my own project, Rabbyt
> (http://matthewmarshall.org/projects/rabbyt/) Like Simon's GFX, it's done
> in Pyrex for speed. (The two libraries can actually be used simultaneously
> without problems.)
>
> Here's a port of Simon's "dumb" example (quick, untested):
>
> import pygame
> import rabbyt
>
> rabbyt.init_display()
>
> ball = rabbyt.Sprite("ball.png")
>
> # Make the ball bounce up and down :-)
> ball.y = rabbyt.lerp(0, 100, dt=1000, extend="reverse")
>
> running = True
> while running:
> if QUIT in (i.type for i in pygame.event.get()):
> running = False
> rabbyt.clear()
> rabbyt.set_time(pygame.time.get_ticks())
> ball.render()
> pygame.display.flip()
>
> On Monday 16 July 2007 02:53:43 Simon Wittber wrote:
> > I've been told pyglet (http://pyglet.org/) is approaching a stable
> > release. AFAIK, Pyglet works without pygame.
> >
> > If you're after brain dead simple 2D OpenGL functions only, try gfx.gl
> > in the GFX package. (http://cheeseshop.python.org/pypi/GFX).
> >
> > Dumb GFX example:
> >
> > 1 import pygame
> > 2 from pygame.locals import *
> > 3 from gfx import gl
> > 4
> > 5 pygame.init()
> > 6 flags = OPENGL|DOUBLEBUF|HWSURFACE
> > 7 pygame.display.set_mode((800,600), flags)
> > 8 gl.init((800,600))
> > 9 image = pygame.image.load('ball.png')
> > 10 texture_id = gl.load_texture(pygame.image.tostring(image, 'RGBA'),
> > image.get_size())
> > 11 running = True
> > 12 w,h = image.get_size()
> > 13 while running:
> > 14 if QUIT in (i.type for i in pygame.event.get()):
> > 15 running = False
> > 16 gl.draw_quad((0,0),((0,0),(0,h),(w,h),(w,0)),
> > texture_id=texture_id) 17 pygame.display.flip()
> > 18
I've got so many choices...
Too bad I suck at making decisions. :P
I have actually decided that I'd try to use Opioid2D for my first game...
I have decided to make a simple strategy RPG for my first game idea. I'm
leaning toward making it a Touhou doujin game. OK, gotta go... See ya later!